Using enum as a generic type
This article introduces a method of defining a generic type for an enum
for use in generic methods.
This article introduces a method of defining a generic type for an enum
for use in generic methods.
When I was doing my latest redesign of the blog, I came to the point where I needed to implement the viewport meta tag so the design would scale correctly on different devices.
I released my first app on Google Play yesterday!
A binary heap is a binary tree data structure that typically uses an array or list as its underlying data structure. Heaps are one of the fundamental data structures that all software developers should have in their toolkit due to its fast extraction of either the minimum or the maximum element in a collection.
Unfortunately when deleting items in entity framework the SQL commands are issued as single DELETE
statements for each entity. This really becomes a bottleneck when there are a several thousand items. This handy set of extension methods allows convenient and efficient deletion of all entities for a particular type T
. The GetTableName<T>
used function even takes into account table mappings set up with the ModelBuilder
.
Continue readingEntity framework delete all entities extension method
I was thinking the other day how inconvenient it is to use List<T>.BinarySearch
if you don’t want to use the default comparer of T
, needing to go and create a new class that implements IComparer<T>
. Seems overly messy to require a whole new class just to do the binary search.
Continue readingA List<T>.BinarySearch extension that takes a lambda expression
.NET allows us to set the size of a List<T>
` in the constructor if we know the capacity ahead of time. This will save the List’s inner (dynamic) array from being reassigned (and copied) when items are added. While usually this will make a minuscule change to your program, if the list is large enough it saves quite a few operations.
If you haven’t experienced the power of the System.Threading.Tasks
namespace new in .NET 4 you’re missing out. This post is about the Parallel
class which takes all of the complexity out of the seemingly simple task of running multiple functions in parallel.
Continue readingStart using System.Threadng.Tasks.Parallel now!