У меня есть метод с двумя необязательными параметрами.
public IList<Computer> GetComputers(Brand? brand = null, int? ramSizeInGB = null)
{
return new IList<Computer>();
}
Теперь я пытаюсь использовать этот метод в другом месте, где я не хочу указывать аргумент Brand
, а только int
, но я получаю ошибки, используя этот код:
_order.GetComputers(ram);
Ошибки, которые я получаю:
Error 1 The best overloaded method match for 'ComputerWarehouse.Order.GetComputers(ComputerWarehouse.Brand?, int?)' has some invalid arguments C:\Users\avmin!\Documents\InnerWorkings Content\630dd6cf-c1a2-430a-ae2d-2bfd995881e7\content\T0062A2-CS\task\ComputerWarehouse\ComputerStore.cs 108 59 ComputerWarehouse
Error 2 Argument 1: cannot convert from 'int?' to 'ComputerWarehouse.Brand?' C:\Users\avmin!\Documents\InnerWorkings Content\630dd6cf-c1a2-430a-ae2d-2bfd995881e7\content\T0062A2-CS\task\ComputerWarehouse\ComputerStore.cs 108 79 ComputerWarehouse