C# Future Directions: Ruby

| 3 Comments | No TrackBacks

Remember that catchy RubyCLR motto?

Now C# (Anders Hejlsberg) is playing catch up talking about automatic properties:

public string Bar { get; set; }
Above is meant to be translated by a compiler into
private string foo; 
public string Bar 
    get { return foo; } 
    set { foo = value; } 
Now I'm not sure I like reusage of the abstract property notation, but still way to go guys.

Related Blog Posts

No TrackBacks

TrackBack URL: http://www.tkachenko.com/cgi-bin/mt-tb.cgi/631


I believe the idea is to minimize the impact on C# syntax, so reusing existing constructs.
It's not so clean though...

I love the idea too but don't like the abstract property notation either. I always thought it would complimentary to the "event" keyword to do this like so:

class Foo {
public property string Bar;
public readonly property string Foo;

The only case this doesn't handle is set only properties which are so uncommon that I wouldn't mind having to implement the property the old way.

I don't see why they don't just use the trivial property syntax like the one in C++/CLI, which I find just cleaner.

Leave a comment