Welcome to MSDN Blogs Sign in | Join | Help

jaredpar's WebLog

Code, rants and ramblings of a programmer.

Syndication

News

Now Reading

Expert F#

What's a better book to read when learning F#?

Essential WPF

Thus far the best book I've read on WPF. Gets right down to working with WPF and the goals/history.

Purely Functional Data Structures

Reading this book makes me feel like I'm back in college. It will really get your mind going and is best read with a whiteboard handy.


Browse by Tags

All Tags » Patterns » C#   (RSS)
Yet another rule for Equality
"If you implement equality in a child class, including operators, you must implement the equality operators in the base class." Unfortunately this is another case of learn the hard way but makes sense when you think about it. The below code snippet is Read More...

Posted Friday, July 11, 2008 8:00 AM by Jared Parsons | 6 Comments

Filed under: ,

Enums vs. Adapters
I like Enums and use them frequently for options and behavior.  To an extent I use Enum's to control behavior.  For example enum Kind { Kind1, Kind2, Kind3 } class Example { private Kind m_kind; public int SomeAction() { switch (m_kind1) { case Read More...

Posted Wednesday, June 18, 2008 8:00 AM by Jared Parsons | 9 Comments

Filed under: ,

Switching on Types
One action I find frustrating in C# is where a particular action needs to be taken based off of the type of a particular object. Ideally I would like to solve this with a switch statement but switch statements only support constant expressions in C# so Read More...

Posted Friday, May 16, 2008 8:00 AM by Jared Parsons | 8 Comments

Design Guidelines: Provide type inference friendly Create function for generic objects
Really this guideline is a bit longer but putting it all in a blog title seemed a bit too much.  The full guideline should read: "If a generic class constructor arguments contain types of all generic parameters, provide a static method named Read More...

Posted Friday, April 11, 2008 8:24 AM by Jared Parsons | 3 Comments

Filed under: , , ,

Have an IComparer<T> but need an IComparable<T>?
Previously we discussed the opposite problem.  This is a lesser but often more frustrating problem because there is no, AFAIK, built in solution for the BCL.  However it's problem that can be solved once and reused with a generic solution. IComparable<T> Read More...

Posted Wednesday, April 09, 2008 8:20 AM by Jared Parsons | 0 Comments

Filed under: , ,

SynchronizationContext and Higher Order Functions
It's often useful to ensure that actions occur on specific threads, in particular event handlers.  Take Windows Forms for instance where all operations on a Control must occur on the thread it was created on.  Typically this is not a problem Read More...

Posted Sunday, February 24, 2008 4:42 AM by Jared Parsons | 1 Comments

Factory Methods for Futures
Like most generic classes, I prefer to create Future instances through static factory methods which allows me to take maximum advantage of type inference. In addition to the 2 straight forward declaration of Func<T> and Action, the methods will Read More...

Posted Saturday, February 23, 2008 8:35 PM by Jared Parsons | 1 Comments

Filed under: , ,

Building a Future which returns no Value
In addition to Future<T> there is also the concept of Futures that don't return any values.  Instead the perform the operation and return.  Because there is no additional data to pass between the threads building an Empty Future is fairly Read More...

Posted Monday, February 18, 2008 4:15 PM by Jared Parsons | 1 Comments

Filed under: , , ,

Push Enumerators
If you read Jon Skeet's blog you'll notice he's been playing around lately with "push" style enumerators. Push enumerators are the concept of "we'll tell you when we're ready". This is different from IEnumerator<T> which is more of a pull; "ask Read More...

Posted Tuesday, February 05, 2008 12:26 PM by Jared Parsons | 1 Comments

Filed under: , ,

Tuples Part 6: Comparing
Part 5 produced equality tests for Tuples. This section will add comparison support through the IComparable<T> interface. Implementing comparable is very similar to adding equality support. Once again there is a generic class available to make all Read More...

Posted Tuesday, January 22, 2008 1:56 AM by Jared Parsons | 3 Comments

Filed under: , , ,

Page view tracker