1- // Copyright (c) Six Labors.
1+ // Copyright (c) Six Labors.
22// Licensed under the Apache License, Version 2.0.
33
44using System ;
@@ -17,27 +17,27 @@ public class ImageFormatManager
1717 /// Used for locking against as there is no ConcurrentSet type.
1818 /// <see href="https://github.com/dotnet/corefx/issues/6318"/>
1919 /// </summary>
20- private static readonly object HashLock = new object ( ) ;
20+ private static readonly object HashLock = new ( ) ;
2121
2222 /// <summary>
2323 /// The list of supported <see cref="IImageEncoder"/> keyed to mime types.
2424 /// </summary>
25- private readonly ConcurrentDictionary < IImageFormat , IImageEncoder > mimeTypeEncoders = new ConcurrentDictionary < IImageFormat , IImageEncoder > ( ) ;
25+ private readonly ConcurrentDictionary < IImageFormat , IImageEncoder > mimeTypeEncoders = new ( ) ;
2626
2727 /// <summary>
2828 /// The list of supported <see cref="IImageEncoder"/> keyed to mime types.
2929 /// </summary>
30- private readonly ConcurrentDictionary < IImageFormat , IImageDecoder > mimeTypeDecoders = new ConcurrentDictionary < IImageFormat , IImageDecoder > ( ) ;
30+ private readonly ConcurrentDictionary < IImageFormat , IImageDecoder > mimeTypeDecoders = new ( ) ;
3131
3232 /// <summary>
3333 /// The list of supported <see cref="IImageFormat"/>s.
3434 /// </summary>
35- private readonly HashSet < IImageFormat > imageFormats = new HashSet < IImageFormat > ( ) ;
35+ private readonly HashSet < IImageFormat > imageFormats = new ( ) ;
3636
3737 /// <summary>
3838 /// The list of supported <see cref="IImageFormatDetector"/>s.
3939 /// </summary>
40- private ConcurrentBag < IImageFormatDetector > imageFormatDetectors = new ConcurrentBag < IImageFormatDetector > ( ) ;
40+ private ConcurrentBag < IImageFormatDetector > imageFormatDetectors = new ( ) ;
4141
4242 /// <summary>
4343 /// Initializes a new instance of the <see cref="ImageFormatManager" /> class.
@@ -113,9 +113,7 @@ public IImageFormat FindFormatByFileExtension(string extension)
113113 /// <param name="mimeType">The mime-type to discover</param>
114114 /// <returns>The <see cref="IImageFormat"/> if found; otherwise null</returns>
115115 public IImageFormat FindFormatByMimeType ( string mimeType )
116- {
117- return this . imageFormats . FirstOrDefault ( x => x . MimeTypes . Contains ( mimeType , StringComparer . OrdinalIgnoreCase ) ) ;
118- }
116+ => this . imageFormats . FirstOrDefault ( x => x . MimeTypes . Contains ( mimeType , StringComparer . OrdinalIgnoreCase ) ) ;
119117
120118 /// <summary>
121119 /// Sets a specific image encoder as the encoder for a specific image format.
@@ -146,10 +144,7 @@ public void SetDecoder(IImageFormat imageFormat, IImageDecoder decoder)
146144 /// <summary>
147145 /// Removes all the registered image format detectors.
148146 /// </summary>
149- public void ClearImageFormatDetectors ( )
150- {
151- this . imageFormatDetectors = new ConcurrentBag < IImageFormatDetector > ( ) ;
152- }
147+ public void ClearImageFormatDetectors ( ) => this . imageFormatDetectors = new ( ) ;
153148
154149 /// <summary>
155150 /// Adds a new detector for detecting mime types.
@@ -193,9 +188,6 @@ public IImageEncoder FindEncoder(IImageFormat format)
193188 /// <summary>
194189 /// Sets the max header size.
195190 /// </summary>
196- private void SetMaxHeaderSize ( )
197- {
198- this . MaxHeaderSize = this . imageFormatDetectors . Max ( x => x . HeaderSize ) ;
199- }
191+ private void SetMaxHeaderSize ( ) => this . MaxHeaderSize = this . imageFormatDetectors . Max ( x => x . HeaderSize ) ;
200192 }
201193}
0 commit comments