One liners

October 12, 2007

OK, can’t really take credit for this one (thx Cristian), but wanted to share a C# one liner with you. If you know me and seen my code you should know that I love those one line statements, especially for properties.

So here it is, a one line lazy load property:
private ArrayList _lazyLoadedList;
public ArrayList LazyLoadedList
{
get { return _lazyLoadedList ?? (_lazyLoadedList = new ArrayList()); }
}

And while we’re sharing, you can know that this is how my standard ViewState properties has been looking since 2.0.
public virtual string Text
{
get { return (string)(ViewState["Text"] ?? string.Empty); }
set { ViewState["Text"] = value; }
}

Damn I love that ??-operator!

Why am I here?

October 3, 2007

Is the first post the hardest to write? Or the easiest? If I keep it short it will be easy. Really short. Really easy.

Moving to New Zealand. Very soon. It’s going to be a huge experience I think. It’s almost the exact opposite side of the earth. Never been there, don’t know anyone there. Feels scary sometimes. Much to do before I go, this blog is one of them. Thought I should start to share my thoughts and ideas to the rest of you. Hopefully I will get going and write some code here real soon.