Format:
Recent snippets for: Bob Baker
[TestMethod] public void CanGetValueItemfromCollection() { var col = new Collection<string> {"Hello", "World"}; var testItem = col.GetValueItem(c => c.Equals("World")); Assert.AreEqual(testItem, "World"); } [TestMethod] public void CanGetReferenceItemfromCollectionByProperty()
83 Views
no comments
/// <summary> /// Find an object in a value-type collection. /// </summary> /// <typeparam name="T">Type of collection.</typeparam> /// <param name="collection">The collection to search.</param> /// <param name="isMatch">The Predicate to test to find the collection item.</param> /// <returns>The collection item.</returns> public static T GetValueItem<T>(this ICollection<T> collection, Predicate<T> isMatch) { foreach (var item in collection)
80 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
