var response = await SendCommandToFiscalPrinter(dailyReportCommand.ToArray(), ip, port);…
- User
var response = await SendCommandToFiscalPrinter(dailyReportCommand.ToArray(), ip, port);
Severity Code Description Project File Line Suppression State Message (active) IDE0305 Collection initialization can be simplified FiscalPrinterApi C:\Users\adala\OneDrive\Dokumenty\Posnet\Posnet\PosnetAPI\Services\FiscalPrinterService.cs 199
Zrefaktoryzuj powyższy kod, aby pozbyć się komunikatu. dailyReportCommand to typ List?
- Assistant
To eliminate the
IDE0305warning message and simplify your collection initialization, you can use a collection initializer when creating thedailyReportCommandlist. Instead of adding items to the list after its creation, you can initialize it with all its items in one line.Here's how you can refactor your code:
Before Refactoring:
csharp