Suppose I have a list of objects called TheListOfMyObjects
. In that list, there's an object with a property that matches a value: MyObject.TheProperty = SomeValue
.
How can I get the previous 3 objects and the next 3 objects from within this list?
Note that if the object that matches SomeValue
is in first position then I'd need the 3 objects in position 2-5 and the 3 objects in the last 3 positions for a total of 6 objects.
Thanks for your suggestions.