FerretArmy: A Web Developer's Paradise

Pushing the Web Forward, Since 2007

Entries for the ‘C#’ Category

jQuery Ajax Beats ASP.NET Ajax

ASP.NET Ajax is a good technology in theory, but the implementation in practice is anything but smooth. There are many little ‘quirks’ that ASP.NET Ajax does to your page; these quirks almost entirely revolve around the handling of viewstate during ajax calls. ASP.NET Ajax passes the viewstate to the server and back during things like [...]

C# Collapsible Properties

Here’s a sweet way to display properties. Basically, I had a bunch of generic properties that I was using shorthand notation for, and one that was a read-only property which served as an aggregate of a few other properties. I couldn’t shortcut it, but the implementation of it was trivial, so I hid it inside [...]

HybridDictionaries – Careful!

I was refactoring some code the other day, and I noticed that at one point, there was code that created a foreach loop, but it was keeping track of an index inside, by manually incrementing at the end of the foreach loop. Something like this: int index = 0; foreach (Widget widget in WidgetBasket) { [...]

Smart Enumerations, Part II

I’ve made an update to my EnumerationHelpers code since the last release, which you can read about here. Previously, the only attribute that is supported for ‘get’ behavior is the Description attribute. This is all fine and good, but what about when you want to decorate your code with your own custom attributes, yet be [...]

Hacker Email Address Parsing

It’s pretty common nowadays to see any type of email addresses that are publicly posted on the web to be formatted so that they are hard to spot by spambots that just rip through pages, parsing addresses out and adding them to various nefarious mailing lists. Such addresses often look a lot like “myaddress @ [...]

Disabling an Ajax Timer Control

I just got done fixing an issue that I was having with the ASP.NET AJAX Timer control, and I figured I’d write about it because there doesn’t seem to be like a ton of documentation out there right now as to exactly what is going on. Here is the scenario: You have an Ajax enabled [...]

These are not the Same Thing

In C#, the following two pieces of try-catch code rethrowing are not equivalent. Don’t do the first one; the second one is where it’s at. try{…} catch (exception ex) { throw ex; } try{…} catch { throw; } This is because when you rethrow the exception, you’re actually creating a new exception, and the stack [...]

OpenGL Aquarium

So, in lieu of actually straining myself to come up with an interesting new post, here is a(nother) rehash of some content I created when I was in college (in 1999… ugh, too long ago!). I remember being very proud of this when I wrote it. Nowadays, I still find it a bit amusing, but [...]

.NET & Application Pools

[Note: I use the term web application in this post. This is not the Visual Studio 'Web Application' but rather refers to any .NET content that runs under IIS.] Application pools, on the surface, look to be a wonderful addition to IIS 6.0. However, unless you have a good understanding of how application pools work [...]

Describable, Smart Enumerations Helper Class (C# 2.0)

Update – Check out this article for the latest and greatest. I’ve decided to post an EnumerationHelpers class written in C# 2.0. This class allows you to easily work with description tags on your enumeration values, and search them to pull the appropriate value out based on the description. This is great for times like [...]