
.NET
Get flash to fully experience Pearltrees
Beginner's Guide to Reactive Extensions for .NET
Enumeration classes
A common complaint of the Entity Framework is slow insert times for larger datasets. Last night I was trying to insert a catalog of 15k products and it was taking a very long time (I gave up after 5 minutes). I recalled this post a while back from Mikael Eliasson demonstrating SqlBulkCopy using .NET. I had used BCP in SQL server, but not from .NET. I took Mikael’s example and roughed out a reusable generic version below, which produced 15k inserts in 2.4s or +- 6200 rows per second. I upped it to 4 catalogs, 224392 rows in 39s, for +- 5750 rps (changing between 4 files).
Elegant Code » SqlBulkCopy for Generic List<T> (useful for Entity Framework & NHibernate)
VerifyArgs
VerifyArgs is a lightweight, fast and extensible library for method arguments value checks. It's written in C# 4.0 and can be used in .NET FW 4+ and Silverlight 4+ applications. VerifyArgs contains Verify class which can be used to validate arguments of your method: public string MyConcat( string first, string second, int secondCount) { Verify.Args( new { first, second }).NotNull().NotEmpty(); Verify.Args( new { secondCount }).Positive(); // your code } This code ensures that "first" and "second" arguments are not null/empty and "secondCount" is greater than zero.Introduced in the Effective Test Series , the Expected Object pattern is a technique involving the encapsulation of test-specific logic within a specialized type designed to compare its configured state against that of another object. Use of the Expected Object pattern eliminates the need to encumber system objects with test-specific equality behavior, helps to reduce test code duplication and can aid in expressing the logical intent of automated tests. While the Expected Object pattern is a great strategy for helping adhere to good testing practices, the process of actually implementing the required types can be less than motivating. To alleviate the burden of hand-rolling Expected Object types, I created the Expected Objects library. This library provides the ability to compare the state of one object against another without relying upon the provided type’s equality members.
Introducing the Expected Objects Library | Aspiring Craftsman
The DebuggerDisplayAttribute is a powerful way to customize the way values are displayed at debug time. Instead of getting a simple type name display, interesting fields, properties or even custom strings can be surfaced to the user in useful combinations [ DebuggerDisplay ( "Student: {FirstName} {LastName}" )] public sealed class Student { public string FirstName { get ; set ; } public string LastName { get ; set ; } } The DebuggerDisplay attribute can customize the name, value and type columns in the debugger window. Each one can be customized using a string which can contain constant text or expressions to be be evaluated by the expression evaluator.
Normal Stuff - DebuggerDisplay attribute best practices - jaredpar's WebLog - Site Home - MSDN Blogs
Retryable actions in C#
Download the Code In inevitably there will be times during the execution of your application where you will encounter an exception. Most common unavoidable types of exceptions are caused when accessing an external resource such as a database or web service. The resource may be known to have occasional expected.How Duck Typing Benefits C# Developers
Json.NET
C# 4.0/3.0 in a Nutshell - PredicateBuilder
JustDecompile - Free .NET Decompiling Tool
JustDecompile is a new, free developer productivity tool for easy .NET assembly browsing and decompiling. JustDecompile builds on Telerik's years of experience in code analysis and developer productivity tools. JustDecompile lets you effortlessly explore and analyze compiled .NET assemblies, decompiling code with the simple click of a button. You can also visit the JustDecompile feature suggestion forum to let us know what features you'd like to see added to JustDecompile, or vote for ones suggested by your peers.Testing
Some time soon, I want to write about the various Java 7 closures proposals on my blog . However, when I started writing that post I found it was difficult to start off without an introduction to closures. As time went by, the introduction became so long that I feared I'd lose most of my readers before I got to the Java 7 bit. As chapter 5 in the book is largely about anonymous methods and how they provide closures to C#, it seemed appropriate to write this article here. Most articles about closures are written in terms of functional languages, as they tend to support them best. However, that's also precisely why it's useful to have an article written about how they appear more traditional OO languages.
C# in Depth: The Beauty of Closures
Asynchronous Programming
Documentation
The Repository Pattern with Linq to Fluent NHibernate and MySQL | Random Sparks
I have heard a lot of good things about NHibernate, but have never had the opportunity to use it. In this post I will describe how to get started using Fluent NHibernate with Linq to NHibernate using MySQL for a database. To add a bit of concreteness to the design / code, let’s imagine that we need to build out the back-end for a delivery truck management system. The business goal is to strap each truck with internet (3G) GPS radios. The radios will report geo-location tracking information for the truck every 5 minutes.MVC
algorithm - C# rounding DateTime objects - Stack Overflow
I want to round dates/times to the nearest interval for a charting application. I'd like an extension method signature like follows so that the rounding can be acheived for any level of accuracy: static DateTime Round ( this DateTime date , TimeSpan span ); The idea is that if I pass in a timespan of ten minutes, it will round to the nearest ten minute interval.WPF - Silverlight

