So I'm building a small application in C# where I have an IEnumerable that I want to cast into a List. This is what I got:
var enumerable = SettingsManager.ReadSettings();
var list = enumerable.Cast<Setting>().ToList();
The compiler says that ReadSettings cannot be inferred from the usage. This is how ReadSettings look like:
public static IEnumerable<T> ReadSettings<T>()
{
//Code omitted
return JsonConvert.DeserializeObject<T[]>(fileAsString).ToList<T>();
}
>(fileAsString)` or even `IList`, `IEnumerable`