Rainer Stropek

Exploring the Latest Features of .NET and C# by Building a Game

What if you could parse complex data with just a few lines? Discover how C# 11's list patterns make it possible while building a game in .NET 8.

Exploring the Latest Features of .NET and C# by Building a Game
#1about 4 minutes

Setting up the .NET 8 game project with SkiaSharp

The project is configured with .NET 8, WPF for the window, and SkiaSharp for 2D rendering, using a sprite sheet for game assets.

#2about 7 minutes

Building the game window using file-scoped types

The main game window is created using file-scoped types to restrict visibility, along with modern null checking and extension method deconstructors.

#3about 3 minutes

Using top-level statements and natural delegate types

The application entry point is simplified using top-level statements, and natural types allow passing method groups directly to parameters expecting delegates.

#4about 7 minutes

Using raw string literals and UTF-8 for JSON data

Raw string literals simplify embedding multi-line JSON, and the u8 suffix creates an efficient UTF-8 byte span directly from the literal.

#5about 7 minutes

Customizing JSON deserialization with JsonTypeInfoResolver

Use JsonTypeInfoResolver to programmatically apply custom converters to external types during deserialization, avoiding the need for intermediate DTOs.

#6about 4 minutes

Implementing player movement and drawing logic

The core drawing loop is implemented to render the player, and target-typed new() expressions simplify object creation within switch expressions.

#7about 11 minutes

Filtering collections with list pattern matching in LINQ

List patterns are used within LINQ queries to filter collections based on the properties and sequence of their elements.

#8about 14 minutes

Creating generic parsing logic with the IParsable interface

The IParsable<T> interface enables writing generic algorithms for parsing strings, with list patterns used to implement the parsing logic for a custom type.

Related jobs
Jobs that call for the skills explored in this talk.

test

Milly
Vienna, Austria

Intermediate

test

Milly
Vienna, Austria

Intermediate

Featured Partners

Related Articles

View all articles
CH
Chris Heilmann
WeAreDevelopers LIVE days are changing - get ready to take part
Starting with this week's Web Dev Day edition of WeAreDevelopers LIVE Days, we changed the the way we run these online conferences. The main differences are:Shorter talks (half an hour tops)More interaction in Q&AA tips and tricks "Did you know" sect...
WeAreDevelopers LIVE days are changing - get ready to take part
CH
Chris Heilmann
Dev Digest 134 - Where pixels sing?
News and ArticlesWeAreDevelopers LIVE Data and Security Day is on Wednesday, 25/09/2024. Learn about OPC UA Updates, Best Practices for Using GitHub Secrets, Passwordless Web 1.5, Emerging AI Security Risks, Data Privacy in LLMs and get a chance to t...
Dev Digest 134 - Where pixels sing?
LM
Luis Minvielle
The Best Upcoming IT Webinars
Now that you already know what IT webinars are and how they can help you level up your professional appeal, you might want actually to get into one. Live tech webinars are one of the best ways to stay on top of the latest trends and tools because eit...
The Best Upcoming IT Webinars
LM
Luis Minvielle
10 Developer Websites in 2023
As a web developer, you're always investigating how to level up your skills and streamline your workflow. That's why we've gathered a collection of 10 innovative tools that are guaranteed to boost your productivity, enhance your coding abilities, ele...
10 Developer Websites in 2023

From learning to earning

Jobs that call for the skills explored in this talk.

C# Net Developer

C# Net Developer

Developerstrategicsiq Ltd

NoSQL
DevOps
Docker
.NET Core
Kubernetes
+1