With constructors under our belts, we can now talk about initialization of structs and other types. This is a far more complex topic than in C#. Read on to learn a lot of nitty-gritty details!
Posts Tagged conversion
Today we’ll continue talking about special types of functions in C#. Specifically, today’s article will cover indexers, explicit and implicit conversions, and variable numbers of arguments (“var args”).
If you’re thinking “I know what an int
is”, you need to take this little quiz to find out for sure!
AS3 has two integer types: int
and uint
. In my experience, most AS3 programmers just use int
everywhere and ignore uint
. This is usually acceptable as the need for unsigned integers is rare compared to their signed counterparts. However, there are significant performance differences between the two. Read on for the impact of uint
on your loops. The original version of this article’s performance test contained a small-but-critical error that led to a lot of incorrect analysis and results. This version of the article has been corrected.
Five months ago I said I’d talked about explicit type conversion. I hadn’t, really. What I talked about before was type casts. A cast changes the type, not the data. Today, I’m actually going to talk about type conversion and show you the costs of converting between all of your favorite types: int
, uint
, Number
, Boolean
, String
, and even XML
.
I’ve talked before about explicit type conversion and used the function-call style (Type(obj)
) and the as
keyword to accomplish the task. Today, I’m going to talk about implicit type conversion and use—as implicit would imply—no operators at all!