Optional arguments in C# interfaces

Optional arguments are a nice feature in C# that have been around for a while now, they were introduced back in 2010 with C# 4. They are often mentioned in the same breath as named arguments but are two completely different concepts. The great thing with development is that there’s always something new to learn, this week it for me it was the behaviour of optional arguments on interfaces that don’t match the optional argument on the implementing class even though the feature has been around for what? [Read More]

Func<T> vs. Expression<Func<T>> in LINQ

Linq is fantastic in that it provides a consistent syntax to query all sorts of data from in-memory collections, SQL databases, XML files, even external APIs. One of it’s strengths is that you can write a Linq provider for any data source the you want to support. Most people know about the “not obvious until it’s obvious” difference between IEnumerable<T> and IQueryable<T> - one represents an in-memory collection and one represents a query which will be executed at some point against a data source. [Read More]
csharp  linq 

Sorting IQueryables using strings and reflection

Wouldn’t it be great to be able to specify the property to order on at runtime for a LINQ query? I.e. items = items.OrderBy("SomeProperty"); rather than items = items.OrderBy(s => s.SomeProperty); How to dynamically sort an IQueryable Later on in this post we’ll go into depth on how to implement an extension method from first principles to do just that but if you just want to quickly use a string to sort an IQueryable right away- go ahead and install Dynamic LINQ. [Read More]
linq  guide  csharp 

Reactive Extensions .NET: Implementing the circuit breaker pattern

This article assumes you’re familiar with both reactive extensions and the circuit breaker pattern, although we’re focusing on .NET reactive extensions have been implemented in lots of different languages so the same principles apply. Microservices are great but they can be a little temperamental at times because there can be a lot of moving parts to service one request. This isn’t all bad as the server can often tackle each moving part in parallel speeding up the response the client gets. [Read More]
csharp  rx