12
Jun/10
0

Getting Back To My Roots

This spring has been a great opportunity to get out into my yard and do some much needed maintenance.   In the past I would have hired someone to come out and take care of these things for me, but this year I have been consciously seeking out home maintenance activities that I can find enjoyment in.

It has been almost two months now, and I’ve been making regular visits to my yard, working away bit by bit, stopping when my yard waste container is full.   As I’ve been weeding, dead-heading, raking, and trimming, I have realized something quite amazing.  Each time I take on work in the yard, I feel a strange sense of calm come over me, and I unintentionally end up losing hours in it.  Put simply, I love it.

This is somewhat uncharacteristic of me, so I have been meditating on why it is that I find myself so feeling so fulfilled while working in the yard.  Certainly it could just be that I’m getting older and more mature, but I find such explanations to be unsatisfying.  The truth that I have come to realize is that it gives me an opportunity to view life from a completely different perspective, one of plants and bugs.

8
Jun/10
0

Implicit Types (var) in C#

After some thought I’ve come up with two simple rules to go by when using implicitly typed variables to make sure that you don’t end up seeing their nasty, code obfuscating side.  But I’m getting ahead of myself, first the important question that someone is bound to not be asking right about now:

What are Implicit Types?

// Explicit
List<string> userNames = new List<string>();

// Implicit
var userNames = new List<string>();

Implicit types in C# are basically placeholder types that the compiler figures out for you. They may hold any type to begin with, but once they are assigned a value of a certain type, that type is noted by the compiler and will error if you try to assign a different type later.

// Okay! quote is being assigned a string value
var quote = "Things that try to look like things often do look more like things than things.";

// Compile Error! Cannot convert source type 'float' to target type 'string'
quote = 4.0f;