@@ -25,7 +25,7 @@ protected static string ResolveId(CharacteristicObject obj, string actual)
2525 string result = CharacteristicSetPresenter . Display . ToPresentation ( obj ) ;
2626
2727 if ( result . Length == 0 )
28- result = IdCharacteristic . FallbackValue ;
28+ result = IdCharacteristic . FallbackValue ! ;
2929
3030 return result ;
3131 }
@@ -44,7 +44,7 @@ protected CharacteristicObject()
4444 sharedValues = new Dictionary < Characteristic , object > ( ) ;
4545 }
4646
47- protected CharacteristicObject ( string ? id ) : this ( )
47+ protected CharacteristicObject ( string id ) : this ( )
4848 {
4949 if ( ! string . IsNullOrEmpty ( id ) )
5050 {
@@ -79,7 +79,7 @@ private void AssertIsNonFrozenRoot()
7979 AssertIsRoot ( ) ;
8080 }
8181
82- private static void AssertIsAssignable ( Characteristic characteristic , object value )
82+ private static void AssertIsAssignable ( Characteristic characteristic , object ? value )
8383 {
8484 if ( ReferenceEquals ( value , Characteristic . EmptyValue ) || ReferenceEquals ( value , null ) )
8585 {
@@ -140,20 +140,20 @@ public bool HasValue(Characteristic characteristic)
140140 return false ;
141141 }
142142
143- internal T GetValue < [ DynamicallyAccessedMembers ( CharacteristicMemberTypes ) ] T > ( Characteristic < T > characteristic )
143+ internal T ? GetValue < [ DynamicallyAccessedMembers ( CharacteristicMemberTypes ) ] T > ( Characteristic < T > characteristic )
144144 {
145- return ( T ) GetValue ( ( Characteristic ) characteristic ) ;
145+ return ( T ? ) GetValue ( ( Characteristic ) characteristic ) ;
146146 }
147147
148- internal object GetValue ( Characteristic characteristic )
148+ internal object ? GetValue ( Characteristic characteristic )
149149 {
150150 if ( ! sharedValues . TryGetValue ( characteristic , out var result ) )
151151 result = Characteristic . EmptyValue ;
152152
153153 return ResolveCore ( characteristic , result ) ;
154154 }
155155
156- private object ResolveCore ( Characteristic characteristic , object result )
156+ private object ? ResolveCore ( Characteristic characteristic , object result )
157157 {
158158 return characteristic . ResolveValueCore ( this , result ) ;
159159 }
@@ -180,13 +180,13 @@ public object ResolveValue(Characteristic characteristic, IResolver resolver, ob
180180 return resolver . Resolve ( this , characteristic , defaultValue ) ;
181181 }
182182
183- public T ResolveValue < [ DynamicallyAccessedMembers ( CharacteristicObject . CharacteristicMemberTypes ) ] T > ( Characteristic < T > characteristic , T defaultValue )
183+ public T ? ResolveValue < [ DynamicallyAccessedMembers ( CharacteristicObject . CharacteristicMemberTypes ) ] T > ( Characteristic < T > characteristic , T defaultValue )
184184 {
185- return HasValue ( characteristic ) ? GetValue ( characteristic ) : ( T ) characteristic . ResolveValueCore ( this , defaultValue ) ;
185+ return HasValue ( characteristic ) ? GetValue ( characteristic ) : ( T ? ) characteristic . ResolveValueCore ( this , defaultValue ! ) ;
186186 }
187187
188188 [ PublicAPI ]
189- public object ResolveValue ( Characteristic characteristic , object defaultValue )
189+ public object ? ResolveValue ( Characteristic characteristic , object defaultValue )
190190 {
191191 return HasValue ( characteristic ) ? GetValue ( characteristic ) : characteristic . ResolveValueCore ( this , defaultValue ) ;
192192 }
@@ -203,16 +203,16 @@ public object ResolveValue(Characteristic characteristic, object defaultValue)
203203 SetValue ( ( Characteristic ) characteristic , value ) ;
204204 }
205205
206- internal void SetValue ( Characteristic characteristic , object value )
206+ internal void SetValue ( Characteristic characteristic , object ? value )
207207 {
208208 AssertNotFrozen ( ) ;
209209
210210 if ( characteristic . HasChildCharacteristics )
211211 {
212212 AssertIsAssignable ( characteristic , value ) ;
213213
214- var oldObjectValue = ( CharacteristicObject ) GetValue ( characteristic ) ;
215- var newObjectValue = ( CharacteristicObject ) ResolveCore ( characteristic , value ) ;
214+ var oldObjectValue = ( CharacteristicObject ? ) GetValue ( characteristic ) ;
215+ var newObjectValue = ( CharacteristicObject ? ) ResolveCore ( characteristic , value ! ) ;
216216
217217 if ( ! ReferenceEquals ( oldObjectValue , newObjectValue ) )
218218 {
@@ -226,7 +226,7 @@ internal void SetValue(Characteristic characteristic, object value)
226226 }
227227 }
228228
229- private void SetValueCore ( Characteristic characteristic , object value )
229+ private void SetValueCore ( Characteristic characteristic , object ? value )
230230 {
231231 AssertIsAssignable ( characteristic , value ) ;
232232
@@ -243,7 +243,7 @@ private void SetValueCore(Characteristic characteristic, object value)
243243 $ "The current node { this } has value for { characteristic } already.",
244244 nameof ( characteristic ) ) ;
245245
246- var characteristicObject = ( CharacteristicObject ) ResolveCore ( characteristic , value ) ;
246+ var characteristicObject = ( CharacteristicObject ) ResolveCore ( characteristic , value ! ) ! ;
247247 characteristicObject . SetOwnerCore ( OwnerOrSelf ) ;
248248
249249 sharedValues [ characteristic ] = characteristicObject ;
@@ -321,7 +321,7 @@ private void SetValueOnAttach(Characteristic characteristic, object value)
321321 if ( characteristic . HasChildCharacteristics )
322322 {
323323 // DONTTOUCH: workaround on case there were no parent characteristic.
324- var characteristicObject = ( CharacteristicObject ) GetValue ( characteristic ) ;
324+ var characteristicObject = ( CharacteristicObject ? ) GetValue ( characteristic ) ;
325325 characteristicObject ? . DetachFromOwner ( characteristic ) ;
326326 }
327327
@@ -358,13 +358,13 @@ private CharacteristicObject ApplyCore(
358358 {
359359 if ( ! HasValue ( characteristic ) )
360360 {
361- var characteristicObject = ( CharacteristicObject ) ResolveCore ( characteristic , value ) ;
361+ var characteristicObject = ( CharacteristicObject ? ) ResolveCore ( characteristic , value ) ;
362362 if ( characteristicObject != null )
363363 {
364364 value = Activator . CreateInstance ( characteristicObject . GetType ( ) ) ;
365365 }
366366
367- SetValueCore ( characteristic , value ) ;
367+ SetValueCore ( characteristic , value ! ) ;
368368 }
369369 }
370370 else
@@ -399,20 +399,20 @@ protected CharacteristicObject UnfreezeCopyCore()
399399 {
400400 AssertIsRoot ( ) ;
401401
402- var newRoot = ( CharacteristicObject ) Activator . CreateInstance ( GetType ( ) ) ;
402+ var newRoot = ( CharacteristicObject ) Activator . CreateInstance ( GetType ( ) ) ! ;
403403 newRoot . ApplyCore ( this ) ;
404404
405405 // Preserve the IdCharacteristic of the original object
406406 if ( this . HasValue ( IdCharacteristic ) )
407407 {
408- newRoot . SetValue ( IdCharacteristic , this . GetValue ( IdCharacteristic ) ) ;
408+ newRoot . SetValue ( IdCharacteristic , this . GetValue ( IdCharacteristic ) ! ) ;
409409 }
410410
411411 return newRoot ;
412412 }
413413 #endregion
414414
415- public string Id => IdCharacteristic [ this ] ;
415+ public string Id => IdCharacteristic [ this ] ! ;
416416
417417 public override string ToString ( ) => Id ;
418418 }
0 commit comments