public static IReadOnlyCollection<int> FillData(this string[] ids, IReadonlyCollection<int> list)
{
var dataList = list?.ToList() ?? new List<int>();
foreach (var id in ids)
{
dataList.Add(int.Parse(id));
}
return datalist.AsReadOnly();
}
How to create Generic method in order to receive int and long for IReadOnlyCollection param and return the value based on requested type?