@@ -172,8 +172,12 @@ static void ValidatePartSpecifier (string partSpecifier)
172172 throw new ArgumentException ( "Invalid part-specifier." , nameof ( partSpecifier ) ) ;
173173 }
174174
175- AnnotationEntry ( )
175+ AnnotationEntry ( string ? partSpecifier , string entry , string path , AnnotationScope scope )
176176 {
177+ PartSpecifier = partSpecifier ;
178+ Entry = entry ;
179+ Path = path ;
180+ Scope = scope ;
177181 }
178182
179183 /// <summary>
@@ -199,6 +203,7 @@ public AnnotationEntry (string path, AnnotationScope scope = AnnotationScope.Bot
199203 case AnnotationScope . Shared : Entry = path + ".shared" ; break ;
200204 default : Entry = path ; break ;
201205 }
206+
202207 PartSpecifier = null ;
203208 Path = path ;
204209 Scope = scope ;
@@ -233,6 +238,7 @@ public AnnotationEntry (string partSpecifier, string path, AnnotationScope scope
233238 case AnnotationScope . Shared : Entry = string . Format ( "/{0}{1}.shared" , partSpecifier , path ) ; break ;
234239 default : Entry = string . Format ( "/{0}{1}" , partSpecifier , path ) ; break ;
235240 }
241+
236242 PartSpecifier = partSpecifier ;
237243 Path = path ;
238244 Scope = scope ;
@@ -267,6 +273,7 @@ public AnnotationEntry (BodyPart part, string path, AnnotationScope scope = Anno
267273 case AnnotationScope . Shared : Entry = string . Format ( "/{0}{1}.shared" , part . PartSpecifier , path ) ; break ;
268274 default : Entry = string . Format ( "/{0}{1}" , part . PartSpecifier , path ) ; break ;
269275 }
276+
270277 PartSpecifier = part . PartSpecifier ;
271278 Path = path ;
272279 Scope = scope ;
@@ -290,7 +297,7 @@ public string Entry {
290297 /// Gets the part-specifier component of the annotation entry.
291298 /// </remarks>
292299 /// <value>The part-specifier.</value>
293- public string PartSpecifier {
300+ public string ? PartSpecifier {
294301 get ; private set ;
295302 }
296303
@@ -327,7 +334,7 @@ public AnnotationScope Scope {
327334 /// <param name="other">The <see cref="MailKit.AnnotationEntry"/> to compare with the current <see cref="MailKit.AnnotationEntry"/>.</param>
328335 /// <returns><see langword="true" /> if the specified <see cref="MailKit.AnnotationEntry"/> is equal to the current
329336 /// <see cref="MailKit.AnnotationEntry"/>; otherwise, <see langword="false" />.</returns>
330- public bool Equals ( AnnotationEntry other )
337+ public bool Equals ( AnnotationEntry ? other )
331338 {
332339 return other ? . Entry == Entry ;
333340 }
@@ -371,7 +378,7 @@ public bool Equals (AnnotationEntry other)
371378 /// <param name="obj">The <see cref="System.Object"/> to compare with the current <see cref="MailKit.AnnotationEntry"/>.</param>
372379 /// <returns><see langword="true" /> if the specified <see cref="System.Object"/> is equal to the current
373380 /// <see cref="MailKit.AnnotationEntry"/>; otherwise, <see langword="false" />.</returns>
374- public override bool Equals ( object obj )
381+ public override bool Equals ( object ? obj )
375382 {
376383 return obj is AnnotationEntry entry && entry . Entry == Entry ;
377384 }
@@ -427,7 +434,7 @@ public static AnnotationEntry Parse (string entry)
427434
428435 var scope = AnnotationScope . Both ;
429436 int startIndex = 0 , endIndex ;
430- string partSpecifier = null ;
437+ string ? partSpecifier = null ;
431438 var component = 0 ;
432439 var pc = entry [ 0 ] ;
433440 string path ;
@@ -497,12 +504,7 @@ public static AnnotationEntry Parse (string entry)
497504
498505 path = entry . Substring ( startIndex , endIndex - startIndex ) ;
499506
500- return new AnnotationEntry {
501- PartSpecifier = partSpecifier ,
502- Entry = entry ,
503- Path = path ,
504- Scope = scope
505- } ;
507+ return new AnnotationEntry ( partSpecifier , entry , path , scope ) ;
506508 }
507509
508510 internal static AnnotationEntry Create ( string entry )
0 commit comments