Posts for #C#

The online publication Informatik Aktuell has just published a German language article I wrote for them on topics of functional programming in C#. Read it here: Funktionales C# für Fortgeschrittene

I finally got round to something today that has been waiting for a very long time: I published my Functional C# library FCSlib on github and NuGet. I first started working on parts of this back in 2008 and put the library together when I wrote my book Functional Programming in C#.

There are still things I’d like to do for the github project – most importantly, I know I have a set of tests somewhere, but because I was using the library for various purposes over years and I didn’t have source control organized well enough, that stuff is spread out a bit. I need to find everything and probably create a bunch of additional tests for some proper coverage, and hopefully I’ll be able to do that in the future. I also hope to add some documentation, but meanwhile read the book or dig around yourself 😃

I have recently completed my first course for the Pluralsight on-demand library: C# 4.0 New Features. If you’re not familiar with the Pluralsight library, I recommend you check it out - it’s a brilliant resource!

On September 1st, I’ll also deliver a webcast for Pluralsight, called Being dynamic with C# 4.0 – currently on the list here. See you there!

I just got confirmation from my friend John that two classes we’d been discussing for the German market are now announced on his site. Here are the details. From June 27 to July 1, 2011, I’m teaming up with Joerg Neumann and Christian Wenz for a .NET Fundamentals Camp. This class goes an entire week and it’s going to happen in Bad Ems, Germany. Follow this link for all the details and to sign up: .NET Fundamentals in Bad Ems [LINK REMOVED]

From September 14 to 16, 2011, I’ll be in Bad Ems again, to deliver a three day class called Expert C# 2011. This is all about the language C# and all sorts of .NET programming topics related to it. Here’s the details and sign-up link for that class:[Expert C# 2011 [LINK REMOVED]

I just stumbled upon this other thing that I don’t think I know: is it possible to dispatch really dynamically through the DLR, from C#? Let me explain. We know that we can use dynamic in C# 4.0, like so:

dynamic i = 10;

// i is now dynamic, but still works like an int:
int j = i + 10

// I can call crazy stuff on i, but the compiler doesn't care -
// it'll crash at runtime of course
i.DoSomethingYouCantReallyDo();

Gaining knowledge is most fun if you didn’t even know you didn’t have it. I guess it’s the surprise principle – the unexpected christmas gift is one of the nicest to get. Suddenly you learn something you didn’t know, or perhaps, if the subject matter is really something you’re very familiar with, it’s rather that you’re suddenly reminded of something you probably new before but had forgotten about. Great!

I just changed the project type of a library of mine to .NET 4 Client Profile. That library implements a type called Tuple. Of course, in .NET 4 they have introduced their own Tuple type, which lives in the ubiquitous System namespace, so I got lots of error messages from a code file that uses the Tuple type heavily. The compiler was wondering whether that Tuple thing in code was System.Tuple or rather FCSlib.Data.Tuple. Oh dear.

On April 13th, during Microsoft’s inaugural UK TechDays event, I’ll be speaking for the Edge UG at the main Fulham Broadway venue. This is part of what Microsoft call the Fringe events, community hosted events that complement the main Developer and IT Pro days. I will be speaking about functional programming on the .NET platform, using both the C# and the F# languages. Here’s the abstract for this talk:

I posted some sample code recently, for some tests with C# 4.0 dynamic. Now I’ve found a new interesting thing – perhaps this is also related to using beta 2 instead of the RC, again I’ll try this when I get around to it. The thing is, I have created my own dynamic object:

public class MyDynamicType : DynamicObject {
  public override bool TryInvokeMember(InvokeMemberBinder binder,
    object[] args, out object result) {
    Console.WriteLine("TryInvokeMember {0}", binder.Name);

    result = null;
    return true;
  }

  public override bool TryGetMember(GetMemberBinder binder, out object result) {
    Console.WriteLine( "TryGetMember " + binder.Name);
    return base.TryGetMember(binder, out result);
  }
}

Update: Since this behavior hasn’t changed in VS 2010 RC, I have reported the problem to MS on their Connect Site: Dynamic Dispatch in C# doesn’t seem to work in simple case

I’m testing a few things with VS 2010 beta 2, around the “dynamic” keyword in C# 4.0. Mostly good, but there’s a bit of odd behavior – I thought I’d post about it, in case somebody has a comment, and so I don’t forget to test again once I go to the RC again (had it installed the other day, just to find there was no compatible IronPython release and no F# PowerPack either!). So here’s one thing that’s weird. I have two classes:

I was just trying out this piece of code:

dynamic expando = new ExpandoObject( ) {
  FirstName = "Oliver",
  Name = "Sturm"
};