It’s easy to forget about struct
in C#. After all, it’s not available in other languages like Java or AS3 and it seems to have fewer features than good old class
. But struct
can really help you out when it comes to garbage creation! Today’s article discusses some strategies to get the most out of struct
. Read on to learn how to use structs to put a stop to that pesky garbage collector!
Posts Tagged class
When we just need a quick and dirty type to hold some values, C#’s anonymous types fit the bill: var person = { First="John", Last="Doe", Age=42 }
. On the down side, since these types are anonymous they have no explicit type. The var
variable is strongly typed, but you have to use the object
type when passing them to other functions. But then how do you get the fields back out? Today’s article shows you how so that anonymous types will be more useful to you. Read on to find out how to recover anonymous types!
Today we continue the series by wrapping up C#’s class/interface/struct/enum system with a discussion of where to put them all. We’ll focus on package
/namespace
, organizing types into files, and some details of using
/import
.
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.
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.
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.
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.
Let’s continue the From AS3 to C# series from last time by continuing to investigate C# classes from an AS3 developer’s point of view. Today’s article will cover class inheritance, interface implementing, and interface inheritance.
This article is for the AS3 developer who’s decided to switch to Unity and doesn’t know the first thing about programming in C#. It’ll walk you through the basics of C# to get you oriented and productive.
The hidden describeTypeJSON
function is faster than the XML-based describeType
function by default, but we can make it even faster. Today’s article describe just how this is done and achieves a nearly 10x speedup!