RSS 2.0 | Atom 1.0 | CDF

Navigation

Search

Categories

On this page

No Excuses!!
Studying for GMAT
Time well spent???
Generic Lists....I Love Them

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Send mail to the author(s) E-mail Shary

Total Posts: 26
This Year: 2
This Month: 0
This Week: 0
Comments: 4

Sign In

 Wednesday, April 04, 2007
4/4/2007 8:37 PM ( )

Ok..so it’s been a while since my last blog post and it’s all my fault. When I started writing this blog I was thinking of all the reasons I could write down to cover for my lack of blogging. But I have a new mantra that I have been living by recently.

NO EXCUSES!

Yes, I decided a while back not to use any excuse, justifiable or not, to explain something that didn’t go my way, or something I couldn’t deliver or get done. Whether it be hitting the gym 4 times a week, giving back to the community via blogging and mentoring, spending time with my girlfriend, or calling my mom, I must deliver or hold no one but myself responsible. This way of thought has really changed my outlook; I feel more empowered and driven. I  achieve more as I no longer have the privilege of blaming the dog for eating my homework.

So that brings me to the goal I had set for myself for sharing what little I can with the IT community through this blog. So here I go again with renewed passion and promise to bring you some nuggets of .NET at least thrice a week.

Stay tuned…..

Comments [0] | | # 
 Tuesday, February 20, 2007
2/20/2007 9:29 PM ( )

Lately, I’ve been upto my eyeballs in High School math. I swear I calculated the area of a circle inscribed in a square in my dreams last night. So today after work, I did a few practice tests..again. Here’s a little taste to what I’m up against:

GMAT Question

Now try this one:
GMAT Question2

Overall, they are not so hard..but doing 40 of them in under 2 minutes per question makes my mind go mushhhhhhh……..

Comments [0] | | # 
 Saturday, February 17, 2007
2/17/2007 5:12 PM ( )

I don’t blog half as often as some of my favorite bloggers and yet, just the other day, I found myself blogging as my girlfriend was calling me to bed.

Understanding Women

Comments [0] | | # 
 Thursday, February 15, 2007
2/15/2007 10:50 PM (  |  )

I became a fan of generic Lists in .NET 2.0 about 5 months back and have not stopped loving them since. The power of a strongly-typed list amazes me everyday and I have used them 69 different ways to accomplish various goals. Just today, I was reviewing some code that I wrote about 6 months back, and I just about smacked myself. Here was a perfect refactoring opportunity to leverage the power of List<>. The combination of a Generic List with Anonymous Delegates is a power-pack worthy of  a standing ovation. Here’s the before:

    1 public List<Job> RetrieveJobListForCurrentProjects()

    2         {

    3             List<IProject> currentProjects = RetrieveCurrentProjects();

    4             List<Job> jobList = RetrieveJobList();

    5             List<Job> filteredJobList = new List<Job>();

    6 

    7             foreach (Job job in jobList)

    8             {

    9                 bool found = false;

   10                 foreach (Project project in currentProjects)

   11                 {

   12                     if (project.JobNumber == job.JobNumber)

   13                     {

   14                         found = true;

   15                         break;

   16                     }

   17                 }

   18                 if (!found)

   19                     filteredJobList.Add(job);

   20             }

   21             return filteredJobList;

   22         }

Yes, I could have traversed the list backwards and removed items, but that still doesn’t come close to what follows, thanks to .NET 2.0!

    1         public List<Job> RetrieveJobListForCurrentProjects()

    2         {

    3             List<IProject> currentProjects = RetrieveCurrentProjects();

    4             List<Job> filteredJobList = RetrieveJobList();

    5 

    6             foreach (IProject project in currentProjects)

    7             {

    8                 filteredJobList.RemoveAll(delegate(Job job) { return job.JobNumber == project.JobNumber; });

    9             }

   10 

   11             return filteredJobList;

   12         }

Ahhh..isn’t that more soothing to the eye and the mind. The funny thing is that I can no longer bring myself to write the earlier version, yet I know some people who repeatedly disagree with me and suggest that the first version is simpler and easier to read.

You Decide!

 

Comments [1] | | #