As a C# developer, you realy get acquainted to the fact that every list/array etc. is zero based.
In the early days of my development career, as a VB programmer, the fact that a list was zero or one based was a matter of choice! (yeah, that was fun :))
Anyway, in those days, you always asked yourself: is it zero based or one based.
As i said, these days i don’t… which give me a nice ‘unexpected behaviour’ in Sql Server where not all is zero based:
select CHARINDEX('.Net', 'aaa.Netbbb') select CHARINDEX('.Net', '.Netbbb') select CHARINDEX('.Net', 'aaa.N.etbbb')
Returns, in that order: 4, 1 and 0.
So if you type this
"somestringvalue".IndexOf("sometext") >= 0
in c#, you must remove the “>” in Sql.
A minor difference, but in the edge cases of the unit test a large difference🙂