Quantcast
Channel: This is an EX blog...
Browsing index pages (26 articles)
↧

Chain – a LINQ operator for dealing with Linked Lists

I don’t think there’s anything in LINQ that will do this, though I expect I’m wrong - I have a tendency to write my own extension method to do something and then discover that LINQ already provides a...

View Article


Generic Value Object With Yield Return

Inspired by this and this, here's my version.Jan Van Ryswyck is right to use static reflection, and to do that he "registers" the properties in a list. On the other hand, assuming you'd have a lot of...

View Article


Lazy Sequence Generation without using Yield Return

C# has the yield return feature, which makes it easy to write state machines as if they were plain old methods:class Program { static IEnumerable<int> SomeNumbers() {...

View Article

VC++16 has decltype in Beta 1 (so Linq to C++0x looks a little nicer)

This post has moved to my new(er) blog and can be found here: http://smellegantcode.wordpress.com/2009/05/22/vc16-has-decltype-in-beta-1-so-linq-to-c0x-looks-a-little-nicer/A while ago I wrote up a...

View Article

Recovery

If you want your application to be able to recover from a crash, it would NOT be ideal for it to restore the exact state it was in immediately before the crash, because then it would just crash...

View Article


When to use Stored Procedures?

No coding blog would be complete without an overly-simplistic salvo fired into this bloody online battlefield, so here's mine.What if you're writing an application that will make heavy use of an...

View Article

General form of C# Object Initializers

C# has a language feature that allows several properties of an object to be assigned to as a suffix to a new expression, namely the object initializer:var myObj = new MyClass { SomeProperty = 5,...

View Article

Readonly Fields and Thread Safety

In C# you can mark the fields of a type as readonly (indeed you generally should if it's a struct). By doing so, you make it illegal to change the fields except in a constructor of the type.The...

View Article


JavaScript Invaders!

Click in the small text field in the top left corner to give allow the game to receive keyboard events.Z = left X = right M = fire

View Article


The Amazing Speed of the .NET Garbage Collector

Coming from a C++ background, I always balk at designs that involve lots of small heap allocations. It’s something I’m gradually training myself to stop doing, because in managed code, it’s a...

View Article

Making Lambdas and Iterators Play Nicely Together

The major problem with this idea is in my favourite feature of C#. In an iterator (a function containing the yield keyword), the code is transformed into a state machine represented by a class. It has...

View Article

Fatal Exceptions, and Why VB.NET Has a Purpose!

There’s a feature in the CLR that is exposed in VB.NET and not in C#. Apparently this is a deliberate decision made by the C# team, which so far they’ve stuck to. Unfortunately, it’s a pretty important...

View Article

What's Wrong With C# 4.0's dynamic Keyword, and How I Think It Should Be Fixed

Update: Exactly what I want, already implemented, complete with caching of the call site. Also, Microsoft's Mads Torgersen responds to this suggestion here. C# 4.0 proposes to add the dynamic keyword...

View Article


General Theory of Resources

Having blogged the other day about a different way of doing automatic cleanup, I’ve been mulling it over and also answering a question on StackOverflow, and decided that I need to assemble a taxonomy...

View Article

Displaying a nested evaluation tree from Expression

Updated: The downloadable source (see link below) is now tidied up a bit, and also displays any embedded string comparisons in a similar way to NUnit.This might be useful as a way to write Assert...

View Article


A functional replacement for the using statement

The using-statement is just that: a statement. Why does this bug me?The FileStream object has a Length property. Assuming I have a function Open that returns a FileStream ready for us, it is awfully...

View Article

Further Muddying the ForEach Waters

ForEach is regularly proposed as a missing feature in the BCL but has been rejected in the past apparently because it wouldn't be "functional" enough, doesn't return anything so calls cannot be chained...

View Article


Using Collection Initializers with Immutable Lists

The Incomparable Mr Skeet mentions how irksome it is that collection initializers assume that the collection is mutable.Suppose we defined an "immutable-yet-initializable collection" as any type that...

View Article

Linq to C++0x

Updated 2009-01-28 - completely different approach to get a fluent interface.Updated 2009-05-22 - See new post with decltype goodness!C++ has long had some functional-styled things in its standard...

View Article

Ora Stories

I've written an add-in for Visual Studio called Ora. You can read more about it via that link but here's some background to it.It's designed to replace a common use of regions - though I'd call it a...

View Article
Browsing index pages (26 articles)


Latest Images