Archive for category C#

From AS3 to C#, Part 12: Generics Wrapup and Annotations

Tags: ,

Most of C#’s support for generics was covered in the previous article, but today we’ll wrap it up by discussing covariance and contravariance. We’ll also talk about C#’s support for annotations and compare to what’s available in AS3.

Read the rest of this article »

6 Comments

From AS3 to C#, Part 11: Generic Classes, Interfaces, Methods, and Delegates

Tags: , , , ,

Continuing once again, today we cover an exciting new topic: generics! Have you ever wished your classes could be parameterized with a type like Vector.<Type> is? With C# generics, you can! Even better, you can parameterize your interfaces, methods, and delegates too. Read on to learn how.

Read the rest of this article »

12 Comments

From AS3 to C#, Part 10: Alternatives to Classes

Tags: ,

Now that we’ve finished discussing special functions, we can move on to two alternatives to classes: structures and enumerations. These are commonly called structs and enums as most languages use those keywords, including C#. Of course we’ll talk about how to mimic these in AS3, too. Read on to learn about these two important types of data structures available in C#!

Read the rest of this article »

10 Comments

From AS3 to C#, Part 9: Even More Special Functions

Tags: ,

Last week’s article continued the discussion of special types of functions in C#’s class system, including variable numbers of arguments (“var args”), indexers, and conversion operators. Today’s article should finish up the topic of special functions. Read on to learn about the built-in support for delegates, events, and object initializers!

Read the rest of this article »

3 Comments

From AS3 to C#, Part 8: More Special Functions

Tags: , ,

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”).

Read the rest of this article »

1 Comment

From AS3 to C#, Part 7: Special Functions

Tags: , ,

Last week we discussed extension methods and virtual functions and today we’ll continue with more special kinds of C# functions. We’ll cover operator overloading, out parameters and reference parameters.

Read the rest of this article »

4 Comments

From AS3 to C#, Part 6: Extension Methods and Virtual Functions

Tags: ,

Today’s article continues from the last two in discussing features of C# classes that AS3 doesn’t have. We’ll discuss extension methods and the virtual function system that trips up so many C# newcomers.

Read the rest of this article »

1 Comment

From AS3 to C#, Part 5: Static Classes, Destructors, and Constructor Tricks

Tags: , , ,

Last week’s article mostly covered abstract classes, but this week we’ll discuss an even more abstract type of class: static classes. We’ll also explore C#’s anti-constructor, known as a destructor, and some fancy ways to construct a class. Read on and learn some more class-related features that were never available to us in AS3.

Read the rest of this article »

9 Comments

From AS3 to C#, Part 4: Abstract Classes and Functions

Tags: , , , , ,

Continuing from last time, this article begins covering features of C# classes that aren’t in AS3. We’ll begin with abstract classes and functions, which AS3 required workaround code to enforce even at run-time. Today’s article shows you how to use C# to cleanly enforce these at compile-time.

Read the rest of this article »

12 Comments

From AS3 to C#, Part 3: AS3 Class Parity

Tags: , , , , , , ,

Picking up from last time, today we’ll finish off classes in C# from an AS3 perspective in preparation for next week when we delve into all-new concepts that aren’t in AS3 at all. Read on to learn the C# way to implement getters and setters, final functions and classes, const variables, and packages.

Read the rest of this article »

13 Comments