diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-05-22 07:31:53 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-05-22 07:31:53 +0300 |
commit | dcd42a32eb0c40aa51b4243d9155bb17361ec9cf (patch) | |
tree | b8b43a15c2df47e962882ba20cab7fa4b687f199 | |
parent | 0fcc6320249a2bacc821c31d2d8fddb90798d14d (diff) |
WriterFactory refactoring
-rw-r--r-- | RhSolutions.AddIn/Services/WriterFactory.cs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/RhSolutions.AddIn/Services/WriterFactory.cs b/RhSolutions.AddIn/Services/WriterFactory.cs index 3193712..444a62f 100644 --- a/RhSolutions.AddIn/Services/WriterFactory.cs +++ b/RhSolutions.AddIn/Services/WriterFactory.cs @@ -11,14 +11,10 @@ public class WriterFactory public IWriter GetWriter(string writerName) { - if (writerName.Equals("Dxf")) + return writerName switch { - return (IWriter)_serviceProvider.GetService(typeof(DxfWriter)); - } - - else - { - return (IWriter)_serviceProvider.GetService(typeof(ExcelWriter)); - } + "Dxf" => (IWriter)_serviceProvider.GetService(typeof(DxfWriter)), + _ => (IWriter)_serviceProvider.GetService(typeof(ExcelWriter)) + }; } } |