I have a property in a class:
public int this[int index]
{
get { return _desk[index]; }
set { _desk[index] = value; }
}
But I cant use this class in Linq. How to make it ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your class doesn’t implement IEnumerable<T> but has an indexer and a Count property, you can create an IEnumerable of indexes using the Enumerable.Range Method, and project each index to the collection item using the Enumerable.Select Extension Method: