Skip to content

Articles about csharp

Thoughts on software development, games, design, and the things I learn along the way.

Advertisement Talescape
Create a List With Multiple Different Types in C#

Create a List With Multiple Different Types in C#

Generally C# is a very strongly typed language and usually lists allow only one defined data type. Using ArrayList, however, we can get around this restriction to some extent.

Runtime Storage in C#

Runtime Storage in C#

Sometimes you just want to store some random value. For this I wrote the RuntimeStorage class. It serves me in some games as a naive cache for a couple of less important values.

How To Create And Use a Singleton in C#?

How To Create And Use a Singleton in C#?

Creating a Singleton is relatively simple. First we create a static variable _instance. In addition, we create a property Instance. We will use it later to access the Singleton. In addition, a new instance of the class is provided there, if none should exist yet. This way we also ensure that the singleton is initialized at exactly the right moment. Namely, only when we need it.