Hacker News new | ask | show | jobs
by nlogn 5643 days ago
This is actually really easy to do in c#:

  public static bool operator true(Class c)
  {
      return c != null;
  }

  public static bool operator false(Class c)
  {
      return c == null;
  }
To avoid redoing this for each class you can just derive from a base class that implements these.
1 comments

well I know that it is possible, I was thinking of trying to write a similar type function with an extension method, but I just like how its included out of the box in ObjC. Really I think for a general purpose language C# is more flexible and while leveraging .NET you have more tools available to develop rapidly.

Part of me feels that Im not "really programming" when I write managed code though. I like writing C and ObjC because I feel like Im actually flipping switches on the CPU. It is silly I know(and all in my head), but being lower level seems to excite me more.

In reality I think its all about the right tool for the job, and choice is good.