Posts Tagged extension methods

C++ For C# Developers: Part 37 – Missing Language Features

Tags: , , , , , ,

We’ve covered all the features in the C++ language! Still, C# has some features that are missing from C++. Today we’ll look at those and explore some alternatives to fill these gaps.

Read the rest of this article »

4 Comments

IL2CPP Output for C# 7.3: Tuples

Tags: , , , , , , ,

Unity 2018.3 officially launched last Thursday and with it comes support for the very latest version of C#: 7.3. This includes four new versions—7.0, 7.1, 7.2, and 7.3—so it’s a big upgrade from the C# 6 that we’ve had since 2018.1. Today we’ll begin an article series to learn what happens when we use some of the new features with IL2CPP. We’ll look at the C++ it outputs and even what the C++ compiles to so we know what the CPU will end up executing. Specifically, we’ll focus on the new tuples feature and talk about creating, naming, deconstructing, and comparing them.

Read the rest of this article »

3 Comments

Comparing Null Objects

Tags: , , ,

We all use <, <=, >, and >= with integers and floating point values all the time. It just works and it’s built into basically every programming language. These simple operators suddenly become quite a pain when you start wanting to compare other objects. IComparable seems to make it easier, but there’s some trickiness when you start dealing with null objects. Today’s article explores this and ends up with some handy utility functions to take some of the gotchas out of comparing.

Read the rest of this article »

No 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