3 ms·
I actually was just wishing c# had as terse of a null check syntax as ObjC. I love the fact that I can type if(!object) [[Do something]about it] vs if(ob
by S_A_P 16y ago
I actually was just wishing c# had as terse of a null check syntax as ObjC. I love the fact that I can type
if(!object)
[[Do something]about it]
vs
if(object == null)
DoSomething.Aboutit
I know its a small thing, but my typenames are usually lengthy so in practice C# statements can get character heavy.
- nlogn 16y agoThis 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.
- S_A_P 16y agowell 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.