Geeks With Blogs
Will Smith The Blog in Black June 2008 Entries
C# Generics for Enums
It seems that enums might be the neglected step-child when it comes to Generics and Extensions. I've tried defining generics that are constrained to enums. No luck. I faced much frustration trying to get my generic methods to work. I finally came up with a method that meets my need. But, I had to add a little bit of run-time type checking. Instead of repeating Enum.Parse throughout my code, I wanted to create a simple generic extension method that would do it for me. I just discovered that my extension ......

Posted On Saturday, June 28, 2008 11:10 PM

How To Save Work When Safely Overriding Equals
So, I've settled on a pattern that I found somewhere on the web to safely override Equals. I don't remember where I found it, and there are certainly many other good implementations (probably better than mine). Regardless, I found that I do have a repeating pattern. I decided to set out to limit this duplication if I could. Here is what I came up with. 1: public static bool SafeEquals<T>( this T left, object right, Predicate<T> test ) 2: { 3: if( right != null && right.GetType().Equals( ......

Posted On Saturday, June 28, 2008 10:10 PM

Creating a comma separated list from IEnumerable<T>
The string.Join method can come in handy when you want a comma separated list of strings. However, there's a major limitation. To use it, you must provide a one-dimensional string array. What if you have a collection of objects and you want to "Join" a property on the objects (e.g., a comma separated list of IDs). Well, since I couldn't find anything within the framework that would do this for me, I wrote an extension method that meets my need. Updated from James Curran's suggestion in the comments. ......

Posted On Thursday, June 26, 2008 2:58 PM

Oracle Update with Join
[Update Oct ‘09 In response to a number of comments on this post regarding problems with this approach, I’ve added a new blog entry with more details. Check it out.] Those with a SqlServer background will be familiar with the UPDATE .. FROM syntax. For example (totally made up) 1: update employee_bonus 2: set bonus = 0 3: from employee_bonus b 4: inner join employees e on b.employee_id = e.employee_id 5: where e.bonus_eligible = 'N' Those who transitioned from SqlServer to Oracle might find the absence ......

Posted On Wednesday, June 18, 2008 11:19 PM

SlickEdit Tools for Visual Studio - Review
Introduction In all honesty, this review may be a bit premature. However, I wanted to record my thoughts and see if anyone listening shares them or has a difference of opinion. I've been evaluating the SlickEdit Tools and have come up with a few top picks. Also, I have identified some that make little difference to me. First of all, the Tools are segregated into two products: Editing Toolbox and Versioning Toolbox. I'll review them separately. Editing Toolbox Top Picks: Acronyms - This one is quite ......

Posted On Wednesday, June 18, 2008 2:23 AM

Custom GridView Guidelines - Preface
I've had a few people ask me about my custom GridView and whether I can help them with theirs. Though, I cannot share my code directly, I can provide some guidelines. In the coming weeks I plan to post segments stepping through customizing a GridView. My customizations are by no means perfect, and I have had to tweak things as I encounter issues. I look forward to sharing my experiences. I will probably post a multi-part article that walks through customizing a GridView. Again, I will not be posting ......

Posted On Monday, June 9, 2008 9:24 AM

Improve Productivity with Keystroke Shortcuts
I'm clearly not the oldest knife in the drawer, nor am I the youngest. I got involved with computers in my youth just about the time Bill Gates was positioning himself to put a PC in every home. What this means is, I grew up on PCs with no mice; pre-Windows, pre-GUI. I learned how to write "menu" programs that utilized a broader range of ascii characters than most people are familiar with today. The point is, everything I did on the computer I did with the keyboard. I recall in high school, a new ......

Posted On Wednesday, June 4, 2008 1:15 AM

Copyright © Will Smith | Powered by: GeeksWithBlogs.net | Join free