March 20, 2007

substring-before()/substring-after() for C#

XSLT isn't the best language for string processing, but it (XPath actually) has a very handy pair of substring functions: substring-before() and substring-after(). I used to write XSLT a lot and always missed them in C# or Java. Yes, C# and Java have indexOf() and regex, but indexOf() is too low-level ...

March 16, 2007

How you can have Ruby-style enumerations in C# 3.0

Well, I missed MVP Summit this year, so while fellow MVPs enjoying together in Redmond I'm playing with C# 3.0 at home. And I'm in the process of Ruby learning, so what I spotted immediately is the lack (correct me if I'm wrong) of Each() and Map() support in .NET 3.5 collections ...

March 15, 2007

Fast clean way to check if an array contains particular element in C# 3.0

I just started coding some real application with C# 3.0 (this is my favorite way of learning things) and immediately I can say I love it. C# 3.0 is going to be the best C# version ever. For me personally C# 1.0 was "hey look, kinda Java for Windows", C# 2.0 was "finally generics" and ...

November 8, 2006

C# Future Directions: Ruby

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 ...