I wanted to take an opportunity to highlight this fantastic blog post a friend and colleague of mine wrote on Feature Toggling. Continue reading
Extension Methods – What are they?
They are methods written by you which allow you to extend classes that you cannot modify directly. These might be classes you’re using from a third party DLL, or maybe you work in an organisation where your business objects are untouchable by a lowly developer such as yourself (and me), or maybe you just want to add some extra functionality to the String class. If any of these situations ring true then extension methods are something you should know about. Continue reading
Removing items from one list that exist in another seems to be one of a developer’s life’s constants so I thought I’d write a short post showing how to carry out this task with the least amount of lines of code. Continue reading
Okay so I’m not going to get into the debate about whether or not private methods should be unit tested as that’s not the purpose of this post (for what it’s worth I think they shouldn’t be tested), but as MSTest provides functionality to test private methods it makes sense that I should know how to set a test up for the occasion where a client wants me to write unit tests for private methods. Continue reading
One of the requirements for a project I have been working on lately is that paging of data is not allowed. The solution so far had been just to output all the records to a GridView control which was fine until the data behind the application started to grow. Once where only 50, 100, 200 records were being written out we are now getting 1000+ which, as you might expect, was not ideal for page rendering.
So I’ve looked at introducing paging back into the project but in an infinite scrolling capacity. Continue reading
Interesting question asked of me today by another developer who was fairly new to C# and that was
What’s the difference between ref and out?
Well it’s a good question and it took me a minute or two to remember but once I had remembered (and supplemented my knowledge thanks to a bit of Googling) I thought I’d add the answer here. Continue reading
UPDATE: This applies to MVC 5 too
I was kind of surprised recently when I wanted to create an asp.net MVC view with dashes in it and found out that I couldn’t.
To me, reading-a-url-like-this is better than readingaurllikethis so I thought there must be a way to get around this. After all, web apps like WordPress and Umbraco allow this so why can’t I just do it in asp.net MVC?
After doing a bit of research on the subject I found out that I needed to do a couple of things Continue reading
Having successfully implemented OAuth in a recent project I thought I would blog about my experience in getting everything configured.
A question I’m asked from time to time is why and when should I use a using statement within my code.
For me, using statements are all about convenience. They provide a nice simple way of ensuring that I am using IDisposable objects correctly, plus I also like tidy code. What’s an IDisposable object? It’s an object which implementes the IDisposable interface, which from a coding perspective means that you have access to a .Dispose() method Continue reading
DNS lookups. Generally a pain and difficult to do in .Net. The built in Dns class from the System.Net namespace provides a nice way of resolving an IP address or host name via its GetHostEntry() method but if you want to delve a little further into the DNS record then you’re screwed.