Categories
.NET .NET 10 C# CLI Code Desktop Developer File Apps Mobile Tips Visual Studio VS Code VS2022 VS2026 Windows

Run C# Source Files Directly in .NET 10

The file app is a new feature in .NET 10 that lets you run a C# source file directly without requiring a project file, like dotnet App.cs. While the build system is tightly integrated with the project file, it operates virtually within the file-based app execution.

Project components like SDK, properties, references, and packages are now defined directly within the C# source file. This is done with the help of C# Ignored Directives. This ensures seamless integration with the virtual project file.

Categories
.NET .NET 10 .NET MAUI .NET MAUI 10 Android ASP.NET Core Aspire Blazor C# CLI Code Deep Dive Desktop Developer DevOps General Getting Started Hybrid Integration iOS macOS Mobile Visual Studio VS Code Web Windows Xamarin Xamarin.Forms

Integrating .NET MAUI with Aspire: A Comprehensive Guide

Aspire is now the talk of the town. You can build and orchestrate all the dependencies from one single place. In fact, it’s stack streamlined. Learn more about Aspire here.

This article discusses how to integrate .NET MAUI, Microsoft’s cross-platform UI framework, with Aspire.

Aspire supports .NET by default, but since .NET MAUI is designed for multi-targeting from a single project, it presents a minor issue. I’ll offer a workaround until it’s officially supported (coming soon).

For this, I’m using .NET 10 File-based Apps for simplicity. Aspire v9.5 supports this new feature. Consult this article to know more about C# File-apps.

Categories
.NET .NET 10 .NET MAUI Android Blazor C# Code Deep Dive Desktop Developer Getting Started Hybrid iOS Learn Mobile Preview Visual Studio VS Code Web What's New Windows Xamarin Xamarin.Forms

What’s New in C# 14 – Extension Members – A Comprehensive Guide

Introduced in C# 3.0, extension methods are a valuable feature for external types, especially when those types are sealed, such as string.

Roughly two decades later, C# has now finally unveiled support for extending everything.

With the release of .NET 10 Preview 3 (C# 14), it is now possible to define static methods, instance properties, and static properties too. Support for other members will be incorporated in future releases.

Syntactically, an extension method should be defined within a top-level static class. The type of its first mandatory parameter, the one qualified with the this keyword, determines the type being extended. Henceforth, this will be referred to as the receiver type.

All standard query operators of LINQ are defined as extension methods. They are defined in the Enumerable static class within the BCL (in the System.Linq namespace).

For example, the Where extension method applies to all types that implement IEnumerable<T>. Validations and optimizations aside, the typical implementation is as outlined below.