khellang / MimeTypes

A simple lookup from file name/extension to MIME/media type, generated from mime-db, which in turn is compiled from IANA, Apache and nginx's MIME types.
Apache License 2.0
93 stars 23 forks source link

GetMimeTypeExtensions should return string #28

Closed naji-makhoul closed 2 months ago

naji-makhoul commented 2 months ago

when trying to get MimeType in GetMimeTypeExtensions it's shuold rturn string or exciption if not exsits

now it's return IEnumerable string fileExtension = MimeTypes.GetMimeTypeExtensions(mimeType).SingleOrDefault();

string fileExtension = MimeTypes.GetMimeTypeExtensions(mimeType); , will not compile why need to use SingleOrDefault ?

khellang commented 2 months ago

It's named GetMimeTypeExtensions (plural) and returns an IEnumerable for a reason. A MIME/media type can map to many extensions. It's impossible for this library to pick one.