Why can i pass an array to method accepting IList resulting in getting error when trying to use this interface (array does not support Add() obviously)
using System.Collections.Generic;
public class Program
{
public static void Main()
{
string[] thisIsArray = ["A", "B"];
IsThisBug(thisIsArray);
}
public static void IsThisBug(IList<string> array) {
array.Add("Hello");
}
}
IsReadOnly
property which does mitigate a bit; I still don't like the design though). – Sucrose