I have this function from a plugin (from a previous post)
// This method implements the test condition for // finding the ResolutionInfo. private static bool IsResolutionInfo(ImageResource res) { return res.ID == (int)ResourceIDs.ResolutionInfo; }
And the line thats calling this function:
get { return (ResolutionInfo)m_imageResources.Find(IsResolutionInfo); }
So basically I’d like to get rid of the calling function. It’s only called twice (once in the get and the other in the set). And It could possible help me to understand inline functions in c#.
Does that clear it up at all?
Just to further clear things up, looking at reflector, this is what the Find method looks like:
So as you can see, it loops through the collection, and for every item in the collection, it passes the item at that index to the Predicate that you passed in (through your lambda). Thus, since we’re dealing with generics, it automatically knows the type you’re dealing with. It’ll be Type T which is whatever type that is in your collection. Makes sense?