.Net Tips – use DebuggerStepThrough attribute
When debugging your application, don’t you just get annoyed that pressing F11 keep taking you into the get method of the properties (auto-properties excluded!) passed into the method rather than the method you want to step into? I use auto-properties wherever possible because they’re syntactically cleaner and have less maintenance overhead, and I have the …
.Net Tips – using configSource or file attribute to externalize config sections
There’s a little known attribute which was introduced in the .Net framework 2.0 called configSource, which allows you to externalize sections of the configuration file. It works just like the optional file attribute found on the appSettings element: <appSettings file = “relative file name” /> but can be added to any configuration section to specify …
.Net Tips – using configSource or file attribute to externalize config sections Read More »
Functional programming with Linq – Enumerable.Range
In my Learning F# posts you probably saw how you can generate an int array like this: this returns 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. This is pretty cool, and fortunately, you have something very similarly in C# with Enumerable.Range which you can use by supplying a starting number and a …
Functional programming with Linq – Enumerable.Range Read More »
Rx framework – IObservable<T>.Retry
As Wes Dyer put very elegantly: Retry is to Repeat as Catch is to Concat Ok ok, I know that’s not an exact quote, but I’m sure this is what he intended to say in the first instance :-P Anyhow, the IObservable<T>.Retry method has all the same features of its Repeat sister method, in that: …
Rx framework – IObservable<T>.Repeat
Having looked at a number of extension methods in Rx which allows you to combine two observable collections in some way, namely: Zip Merge CombineLatest Concat Catch OnErrorResumeLast There are also extension methods which allow you to repeatedly subscribe to the same observable collection, the suitably name IObservable<T>.Repeat method. If the repeated observable collection is …
Thread-safe enumeration in C#
I had a problem with the project I’m working on at work where on the base class I had a list which its child classes need to have access to in a read-only capacity but manipulation to the list itself is handled by the base class only. However, the standard C# List<T> and Enumerator<T> are …
Rx framework – IObservable<T>.Catch and IObservable<T>.OnErrorResumeNext
Like IObservable<T>.Concat, the IObservable<T>.Catch extension method concatenates an observable collection with another. However, unlike the Concat method where the subscription to the second observable collection happens after the first had completed, in the Catch method the subscription to the second collection happens after and only after the first had excepted! Which begs a very good …
Rx framework – IObservable<T>.Catch and IObservable<T>.OnErrorResumeNext Read More »
Rx framework – IObservable<T>.Concat
Yet another extension method to combine two observable collections, this time we have IObservable<T>.Concat which is very similar to IObservable<T>.Merge, but crucially, when you concatenate one observable collection to another, the subscription to the second observable collection happens after the first had completed! Here’s a quick illustration of how the two methods differ: As you’ve …
Rx framework – IObservable<T>.CombineLatest
The IObservable<T>.CombineLatest extension method is very similar to IObservable<T>.Zip and IObservable<T>.Merge in that it combines two observable collections and returns a new one. Unlike IObservable<T>.Merge, IObservable<T>.CombineLatest does not require the merged observable collections to be of the same type. Like IObservable<T>.Zip, IObservable<T>.CombineLatest combines ‘pairs‘ of values from the two observable collections, but unlike Zip when …