Profile
Achievement
stewartrae's Recent Snippets
- All /
« Prev 1 Next »
A simple, thread-safe wrapper class for lazy-loading data into an instance on-demand (i.e. when the instance is first accessed.)
Usage:
LazyLoader<Foo> l = new LazyLoader<Foo>(() => Foo.LoadFromDataSource("DB Connection String"));
// For acc...
2
1099
posted 13 years ago by stewartrae
C#
TruncateOnWordBoundary - a useful extension method for cutting a string short, but not in the middle of a word.
Ever wanted a method that can truncate a string, but only on a word boundary? This method works like Substring() but doesn't snip a string in the middle of a word, i.e. it only truncates the string on a word boundary. Useful for producing a summary f...
1
1337
posted 13 years ago by stewartrae