Skip to content

Commit b1eeaec

Browse files
author
Claudio Rodrigo Pereyra Diaz
committed
refactor: convert switch statement to expression
1 parent 7e7e4eb commit b1eeaec

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

MailerQ/MessageStore/MessageStorage.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,12 @@ public MessageStorage(IOptions<MailerQConfiguration> options)
3838

3939
private IMessageStorage CreateConcretStorage(StorageEngines storageEngine, string uri)
4040
{
41-
switch (storageEngine)
41+
return storageEngine switch
4242
{
43-
case StorageEngines.MongoDB:
44-
return new MongoDBMessageStorage(uri);
45-
case StorageEngines.S3:
46-
return new S3MessageStorage(uri);
47-
default:
48-
throw new NotImplementedException($"{storageEngine} message storage engine is not implement yet.");
49-
}
43+
StorageEngines.MongoDB => new MongoDBMessageStorage(uri),
44+
StorageEngines.S3 => new S3MessageStorage(uri),
45+
_ => throw new NotImplementedException($"{storageEngine} message storage engine is not implement yet."),
46+
};
5047
}
5148

5249
/// <inheritdoc/>

0 commit comments

Comments
 (0)