A simple solution for var and int arrays and the like obviously is to save the size in the zero index.
Keep in mind that you lose one index/ have to allocate one more (and I would save "size-1" in the zero index then).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends