Archive

Posts Tagged ‘wish’

General form of C# Object Initializers

March 29, 2009 3 comments

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:
Read more…

Categories: syntax, wish Tags: ,

Chain – a LINQ operator for dealing with Linked Lists

November 13, 2008 Leave a comment

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 general version of it. But in the mean time, here’s my Chain method:

Read more…

Categories: BCL, C#, LINQ, wish Tags: , , ,

Observable Property Pattern

August 22, 2008 1 comment

Is there something like this in the standard libraries? And if not, why not?

Read more…

Categories: BCL, C#, wish Tags: , ,

Virtual Properties in C#

May 22, 2008 2 comments

It is an important and popular fact that properties in C# can be defined in interfaces. For example:

public interface IThing
{
    IThing Parent { get; }
}

We can then implement that interface on a concrete class:

Read more…

Categories: C#, wish Tags: ,

A new use for the C# using keyword

November 30, 2007 3 comments

It worries me that the using keyword doesn’t have enough meanings already! But coming from a C++ background I’m very keen on the using (…) { scope } syntactic sugar. It helps with clients of IDisposable objects. But so far, it provides no help for implementors. So my suggestion is to allow the using keyword to act as a modifier on member variables.

Simple example:

class B { using FussyResource X; } 

is equivalent to:

Read more…

Categories: C#, IDisposable, wish Tags: , ,
Follow

Get every new post delivered to your Inbox.