Screenshot_10_26_14__7_52_pm_large

Khalid Abuhakmeh

Software Developer and All Around Nice Guy @AquaBirdConsult

Introduction to Generics in .NET

Generics are an essential feature of any statically typed language, and C# is no exception. Introduced in .NET 2.0, generics offer a way to strongly type container- like classes at compile time, rather than hoping all goes well at runtime. Previous to the introduction of generics, most developers were forced to cast to the base object class, . . .

Read More

April 26, 2015

Using Lazy For Expensive Data in C#

It's ok to be lazy

I am a big fan of stateful properties on my C# objects, especially when it comes to ViewModels in ASP.NET MVC. Stateful properties describe the current internal state of your object using one or more existing members. Take a look at the following code snippets and consider which one you like better.

var result = !string.IsNullOrWhitespace( . . .

Read More

April 25, 2015

Take Your ASP.NET MVC Application Offline via a Global Attribute

Failure is inevitable when building applications. ASP.NET has the ability to take an application offline when things have really gone past the point of recovery. I'll let Scott Guthrie explain how it works.

Basically, if you place a file with this name [**app_offline.htm**] in the root of a web application directory, ASP.NET 2.0 will . . .

Read More

April 22, 2015

ASP.NET WebAPI and Multi-Column Sorting Queryables

Useful for other scenarios as well

Whenever building a querying API, whether web or local,I want to expose some basic features for my consumers: filtering, paging, and sorting. The first two are really easy to implement; well easy in respect to having solved them. Sorting on one field is easy, but becomes increasingly difficult when sorting on multiple fields. In this post, . . .

Read More

April 19, 2015

A Better Validation Result For ASP.NET WebAPI

WebAPI is starting to grow on me. Just like any framework, it takes time to configure it the way I like, but luckily I've been able to configure everything that doesn't work with my sensibilities. One of the features I decided to tweak, is the format of the validation messages that come from WebAPI.

 if (!ModelState.IsValid) return  . . .

Read More

April 18, 2015

Teamwork and Position Players

Who's on first?

Development teams are not unlike a professional sports team: everyone on the team needs to play their position, and play that position to the best of their ability. In a development environment, positions are designated by title. Titles are not meant to limit an individual, but are meant to set a baseline expectation for performance.

Junior

A . . .

Read More

April 12, 2015

An Overview of Lambdas in .NET

Lambdas, Actions, Funcs, and Predicates

Lambdas were a great addition to the .NET Framework in 2008, but can still be confusing
for many modern .NET developers. MSDN defines lambdas as the following:

A lambda expression is an anonymous function that you can use to create delegates or expression tree types. By using lambda expressions, you can write local functions that can be passed . . .

Read More

April 09, 2015

Archive

All Categories: c#(1) home