The series continues today by picking up where we left off with pointers. We’ll discuss a popularly-used alternative in C++: references. These are quite different from the various concepts of references in C#!
Posts Tagged value
A lot of times we want to take some action when a value changes. If the player’s level increases I want to play a “ding” sound effect. If a player loses health points I want the screen to flash red. Today we introduce
Observable<T>: an easy way to track these value changes. Read on for the source code and examples!
Pop quiz: what’s the difference between an
Object and a
Dictionary? If you said “
Dictionary can have non-
String keys”, you bought into a common myth. Today’s article shows the cases where the lowly
Object class will use non-
String keys whether you like it or not. Read on for the details.
One of the advantages of using
Dictionary instead of
Object when mapping key-value pairs is that you can use whatever type of key you want, not just a
String. However, a recent comment points out that the keys are still checked with the loose equality operator (
==) and you can therefore get clashes like
4 == "4". For today’s article, I’ve written a
TypesafeDictionary class that allows you to overcome this limitation. Read on for the implementation, performance testing, and more.