General Tips

The reason why you shouldn't use ToList() in a single Lambda Expression

One of the most frequent unnecessary issues I see introduced into a client's code base, is over the usage of ToList(). It's such a simple extension but so many developers balls it up really badly. Here is an obvious example in question: [Te[...]

How To Create A Custom Attribute And Get The Value

I was performing a code and one of the developers needed to return a success/failure result from a method and in the event of an error, return an error message. To solve the problem he used an out parameter like this: public bool IsSuccess(string v[...]

Importing Data Using Json.Net

A very frequent requirement that crops up a lot is the ability to import Json in some shape or form. For my work, importing Json is usually required during the content migration phase but there are far too many possibles. Json and .Net Importing Json[...]

How To Pass HttpContext.Current.Session To A Web API

On a recent project, I had a very unusual requirement, the user's session (from the HTTP Context) should be accessible to an external web API. Although Microsoft does not recommend this practice for several reasons, like: It breaks the RESTFUL ar[...]

How To Get a WCF Service Up And Running In 5 Minutes

Objective In today's tutorial I will demonstrate how to implement a simple service that takes in a GUID and returns an int, how to host it in IIS and how to test it in the WCFTest tool to make sure it works. Step One - Create the service Create a [...]

Homepage Build Csharp Websites General Tips
Back to top