Posts Tagged value

C++ For C# Developers: Part 8 – References

Tags: , , , ,

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#!

Read the rest of this article »

7 Comments

Easily Track Value Changes with Observable<T>

Tags: , , ,

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!

Read the rest of this article »

11 Comments

Using Non-String Keys with Object

Tags: , , , ,

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.

Read the rest of this article »

7 Comments

Typesafe Dictionary

Tags: , , , ,

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.

Read the rest of this article »

4 Comments

Redundant Code

Tags: , , ,

Why do I see so many AS3 programmers writing so much redundant code? Are you one of them? Today’s tips may save you a lot of typing. It may even save you a lot of SWF size.

Read the rest of this article »

20 Comments