One of the coolest features of C# 3.0 is Extension Methods. Basically, an extension method is a static method that can extend a given type (even if that type is closed). The following extension method adds a .ValidateRegularExpression() method to the String object.
public static bool ValidateRegularExpression(this string vali... [More]
I've been writing on a dynamic rules module for AlphaStaff and dug into my framework bag to use this gem. The following function will crawl an object's dependency graph to find out if a class is ultimately a subtype of another class. This code sample is in VB but could be ported to C# easily.
Public Function IsSubClas... [More]
There's always been some confusion for developers on things like naming conventions, coding style, when/where/how to use namespaces, and the like. Microsoft published guidelines for this 3 or so years back and updates them as new releases of .Net come out. You may find them online at:
Most of us use RegEx to validate simple data such as phone numbers of email addresses, but what expression do you choose?
Nothing's quite as good as opening an SMTP outbound connection and starting a session to validate an email address, but this operation is costly for most data entry scenarios, so I've found this RegEx (wh... [More]