1 post tagged “null”
I understand that a basic programming concept is that zero is not nothing (or null). I get it.
But that doesn't mean it isn't a total pain to work with.
In ASP.NET (my favorite language!) I'm working with a dataset. This dataset has no tables in it. So, one might think that the dataset's tables.count property would be 0. Right?
Nope. It's nothing/null.
But shouldn't it be both, technically? There aren't any tables, so that's nothing. But zero can also mean nothing. I know that in the abstract concept sense, it can mean something. But in this specific instance, I have to check for null instead of just checking for zero.
It's kind of lame. I accept it. But it's lame.
---
Oh, okay. Here's why it was nothing: I didn't really make a dataset.
This is a syntax issue with VB.NET (and presumably C#) that trips me a lot.
Dim dsBlah as DataSet
Dim dsBlah as New DataSet
Only the second one makes a dataset. The first one doesn't. It simply reserves the variable. Also, I don't seem to have this problem in PHP. Weird.