August 21, 2008 01:24 by
admin
Glenn Block has an implementation of ForEach for IEnumerable:
1: public static class IEnumerableUtils {
2: public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action) {
3: foreach(T item in collection) {
4: action(item);
5: }
6: }
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
July 14, 2008 00:46 by
admin
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
May 1, 2008 12:18 by
admin
Scott Hanselman is at it again with a smarter and possibly evil ToString extension method. Here is his example usage:
public void MakeSimplePersonFormattedStringWithDoubleFormatted()
{
Person p = new Person();
string foo = p.ToString("{Money:C} {LastName}, {ScottName} {BirthDate}");
Assert.AreEqual("$3.43 Hanselman, {ScottName} 1/22/1974 12:00:00 AM", foo);
}
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
April 7, 2008 01:19 by
Admin
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
April 7, 2008 01:17 by
Admin
Currently rated 5.0 by 4 people
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5
April 7, 2008 01:11 by
Admin
Mehfuz's adds the ability to use the same property multiple times in the where clause of a query to LinqExtender. That's a little confusing, so here is the example that he gave:
var query = from book in _context.Books
where book.PublishedDate > someDate
and book.PublishedDate < someDate
select book;
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
March 16, 2008 03:26 by
admin
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
March 16, 2008 03:19 by
admin
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
March 16, 2008 03:16 by
admin
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
March 11, 2008 10:03 by
Admin
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5