I was working in a custom control today that exposes a dependency property of type System.Collections.ObjectModel.ObservableCollection<System.DateTime>. After typing that type name a few times I decided it was time for a using statement at the top of the file to shorten things up. But even ObservableCollection<DateTime> is pretty long.
I recalled reading about how applying the using statement to create aliases. I wasn’t sure if it would, but sure enough, the following worked like a charm:
That lets me declare my property as a DateTimeList, shortening up the syntax significantly. Here’s a comparison.
With a typical “using System.Collections.ObjectModel”:
With the DateTimeList alias:
The usage feels really nice, but I wondered what others think. Is this alias really cool or just plain wrong?