Posts Tagged reflection

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

C++ For C# Developers: Part 31 – Deconstructing and Attributes

Tags: , , , ,

Both languages have both deconstructing (var (x, y) = vec;) and attributes ([MyAttribute]). C++ differs from C# in several ways, so today we’ll take a look at those differences and learn how to make use of these language features.

Read the rest of this article »

4 Comments

Collections Without the Boxing

Tags: , , , , ,

In last week’s tips for using collections like List<T>, we saw how struct types are sometimes boxed resulting in GC allocations. This week we’ll see how to avoid boxing and learn some of the clever tricks that .NET collection types use to make this possible.

Read the rest of this article »

4 Comments

Object Graph Visualizer

Tags: , , , , ,

C# makes it easy to create large graphs of objects connected by their fields. The larger this graph grows, the more complex it is to deal with objects in the graph. It’s hard to look at code or set a breakpoint in a debugger and get an intuitive sense of all these connections. So today we’ll write a small tool to visualize an object graph!

Read the rest of this article »

5 Comments

IL2CPP Output: readonly, sizeof, IntPtr, typeof, GetType

Tags: , , , ,

Today’s article looks at the IL2CPP and C++ compiler output for a variety of C# language features. Do you want to know what happens when you use them? Read on to find out!

Read the rest of this article »

No Comments

The Magic of LINQ Expressions

Tags: , , ,

LINQ expressions aren’t the same thing as LINQ queries. They’re more like reflection for the syntax of C# itself. It’s a fascinating—and powerful—area of the language and I’ll be exploring it a little in today’s article.

Read the rest of this article »

9 Comments

StrangeIoC Reflection Performance

Tags: , ,

StrangeIoC is a library that can help you build your Unity app with a “pure code” approach. Today’s article addresses one common concern with using StrangeIoC- it uses a lot of reflection. As we know, that’s really slow in Unity. StrangeIoC tries to work around it by letting you control when the reflection takes place so you can put it on a loading screen or some other convenient place. Today’s article finds out just how slow the reflection is to determine if this is really a valid reason to not use StrangeIoC (or other dependency injection frameworks). Read on to find out!

Read the rest of this article »

No Comments

Unity Reflection is Really Slow

Tags: , , , ,

Reflection allows you to introspect your code at runtime. You can do very dynamic things like call functions by their name as a string. As such, it’s a really powerful tool when you code needs to be more flexible. Unfortunately, it’s slow. Really slow. Today’s article puts it up against regular, non-reflection code to show the difference in speed. It’ll also walk you through reflection in C# in case you’ve never used it before. Read on to learn more about reflection in Unity!

Read the rest of this article »

13 Comments