22// Licensed under the Six Labors Split License.
33
44using System . Diagnostics . CodeAnalysis ;
5- using System . Runtime . CompilerServices ;
65using SixLabors . ImageSharp . PixelFormats ;
76
87namespace SixLabors . ImageSharp . Metadata . Profiles . Exif ;
@@ -79,7 +78,7 @@ private ExifProfile(ExifProfile other)
7978
8079 this . InvalidTags = other . InvalidTags . Count > 0
8180 ? new List < ExifTag > ( other . InvalidTags )
82- : ( IReadOnlyList < ExifTag > ) Array . Empty < ExifTag > ( ) ;
81+ : Array . Empty < ExifTag > ( ) ;
8382
8483 if ( other . values != null )
8584 {
@@ -161,7 +160,7 @@ public bool TryCreateThumbnail<TPixel>([NotNullWhen(true)] out Image<TPixel>? im
161160 return false ;
162161 }
163162
164- using ( var memStream = new MemoryStream ( this . data , this . thumbnailOffset , this . thumbnailLength ) )
163+ using ( MemoryStream memStream = new ( this . data , this . thumbnailOffset , this . thumbnailLength ) )
165164 {
166165 image = Image . Load < TPixel > ( memStream ) ;
167166 return true ;
@@ -237,12 +236,12 @@ public void SetValue<TValueType>(ExifTag<TValueType> tag, TValueType value)
237236 return Array . Empty < byte > ( ) ;
238237 }
239238
240- var writer = new ExifWriter ( this . values , this . Parts ) ;
239+ ExifWriter writer = new ( this . values , this . Parts ) ;
241240 return writer . GetData ( ) ;
242241 }
243242
244243 /// <inheritdoc/>
245- public ExifProfile DeepClone ( ) => new ExifProfile ( this ) ;
244+ public ExifProfile DeepClone ( ) => new ( this ) ;
246245
247246 /// <summary>
248247 /// Returns the value with the specified tag.
@@ -267,6 +266,7 @@ public void SetValue<TValueType>(ExifTag<TValueType> tag, TValueType value)
267266 /// </summary>
268267 /// <param name="tag">The tag of the exif value.</param>
269268 /// <param name="value">The value.</param>
269+ /// <exception cref="NotSupportedException">Newly created value is null.</exception>
270270 internal void SetValueInternal ( ExifTag tag , object ? value )
271271 {
272272 foreach ( IExifValue exifValue in this . Values )
@@ -281,7 +281,7 @@ internal void SetValueInternal(ExifTag tag, object? value)
281281 ExifValue ? newExifValue = ExifValues . Create ( tag ) ;
282282 if ( newExifValue is null )
283283 {
284- throw new NotSupportedException ( ) ;
284+ throw new NotSupportedException ( $ "Newly created value for tag { tag } is null." ) ;
285285 }
286286
287287 newExifValue . TrySetValue ( value ) ;
@@ -310,7 +310,7 @@ private void SyncResolution(ExifTag<Rational> tag, double resolution)
310310 this . RemoveValue ( value . Tag ) ;
311311 }
312312
313- var newResolution = new Rational ( resolution , false ) ;
313+ Rational newResolution = new ( resolution , false ) ;
314314 this . SetValue ( tag , newResolution ) ;
315315 }
316316
@@ -328,13 +328,13 @@ private void InitializeValues()
328328 return ;
329329 }
330330
331- var reader = new ExifReader ( this . data ) ;
331+ ExifReader reader = new ( this . data ) ;
332332
333333 this . values = reader . ReadValues ( ) ;
334334
335335 this . InvalidTags = reader . InvalidTags . Count > 0
336336 ? new List < ExifTag > ( reader . InvalidTags )
337- : ( IReadOnlyList < ExifTag > ) Array . Empty < ExifTag > ( ) ;
337+ : Array . Empty < ExifTag > ( ) ;
338338
339339 this . thumbnailOffset = ( int ) reader . ThumbnailOffset ;
340340 this . thumbnailLength = ( int ) reader . ThumbnailLength ;
0 commit comments