I am trying to create and Instantiate IQueryable<T> object in my C# MVC project, but I am not able to create it, I would like to use it instead of List<T> = new List<T>
, so how can I do it? I am trying this
IQueryable<SFLoginMainView> sflogins = new IQueryable<SFLoginMainView>();
But this is not working, Visual Studio is showing error.
You can create it like this
IQueryable<DataType> = Enumerable.Empty<DataType>().AsQueryable();
So, suppose your DataType = "Students" class or model, then it would be like this
IQueryable<Students> = Enumerable.Empty<Students>().AsQueryable();
That's it.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly