Categories
.NET C# CLI Desktop Developer General Getting Started Linux Tools Web What's New Windows

How to Install and Use Microsoft Edit for Simple CLI Text Edits

Want to quickly update a configuration file or edit a solution or project file? Then Microsoft Edit is the ultimate choice. It is a lightweight and easy-to-use text editor from the command line. You can do all this without ever having to switch context.

How to Install:

Plans are to add it to Windows OS soon, making it useful in places where third-party software can’t be installed.

For now, the easiest option to install this editor is using winget:

Categories
.NET .NET 10 ASP.NET Core Aspire Automation Azure Blazor C# CLI Code Desktop Developer Getting Started Linux macOS Mobile Visual Studio VS Code Web What's New Windows

Using C# Ignored Directives: A Guide for Programmers

C# – Preprocessor Directives are highly useful for writing code that can be compiled conditionally, depending on factors like the target framework, target platform, or build configuration.

For example:

#if NET9_0_OR_GREATER
// The code within this block will execute only on .NET 9 or higher
#endif

#if ANDROID
// The code within this block will execute only on the Android OS
#endif

#if DEBUG
// The code within this block will execute only in Debug mode
#endif

C# – Ignored Directives have a similar syntax but are ignored by the compiler because they are for tooling.

The real purpose of this feature is to execute a C# source file directly from the CLI. It doesn’t need a project file. Now, even the plain console app requires a project file, despite the much-simplified top-level statements feature.