Skip to content

Commit

Permalink
changed from switch expression to .NET standard2.0 compatible switch-…
Browse files Browse the repository at this point in the history
…case
  • Loading branch information
danzuep committed Oct 23, 2023
1 parent c947ba5 commit 29e6599
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/MailKitSimplified.Receiver/Services/ImapReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public async Task<IList<string>> GetMailFolderNamesAsync(CancellationToken cance
public async Task<UniqueId?> MoveToSentAsync(IMessageSummary messageSummary, CancellationToken cancellationToken = default)
{
using (var mailFolderClient = _mailFolderClient.Value)
return await mailFolderClient.MoveOrCopyAsync(messageSummary.UniqueId, messageSummary.Folder, mailFolderClient.SentFolder.Value, move: true, cancellationToken).ConfigureAwait(false);
return await mailFolderClient.MoveOrCopyAsync(messageSummary.UniqueId, messageSummary.Folder, mailFolderClient.SentFolder, move: true, cancellationToken).ConfigureAwait(false);
}

public IImapReceiver Clone()
Expand Down
22 changes: 16 additions & 6 deletions source/MailKitSimplified.Receiver/Services/MailFolderClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,24 @@ public async Task<int> DeleteMessagesAsync(TimeSpan relativeOffset, SearchQuery

private IEnumerable<string> GetFolderNames(SpecialFolder specialFolder)
{
var folderNames = specialFolder switch
IList<string> folderNames;
switch (specialFolder)
{
SpecialFolder.Sent => SentFolderNames,
SpecialFolder.Drafts => DraftsFolderNames,
SpecialFolder.Junk => JunkFolderNames,
SpecialFolder.Trash => TrashFolderNames,
case SpecialFolder.Sent:
folderNames = SentFolderNames;
break;
case SpecialFolder.Drafts:
folderNames = DraftsFolderNames;
break;
case SpecialFolder.Junk:
folderNames = JunkFolderNames;
break;
case SpecialFolder.Trash:
folderNames = TrashFolderNames;
break;
// All, Archive, Flagged, Important
_ => throw new NotImplementedException()
default:
throw new NotImplementedException();
};
return folderNames;
}
Expand Down

0 comments on commit 29e6599

Please sign in to comment.