The method comboBoxMonth.Items.AddRange
expects an object[]
parameter. months.ToArray()
is string[]
. A cast from string[]
to object[]
is valid, but if the method tries to modify elements of the array, you will get run-time errors. In this case it doesn’t, so you can ignore the warning.
If it annoys you, you can use ToArray<object>()
comboBoxMonth.Items.AddRange(UsageRptConstsAndUtils.months.ToArray<object>());
It will return object[]
and no cast will be needed.