C# Method Naming Conventions: PascalCase, Async and Try (.NET 10)

C# method naming conventions cheat sheet: CalculateTotal verb phrase, GetQuoteAsync suffix, TryFindPrice Try pattern and OnStockRanLow event method

Quick answer: C# method naming conventions say every method gets a PascalCase verb or verb phrase, like CalculateTotal, async methods end in Async, and parameters stay camelCase: I ran every rule below on .NET 10 against a gear store’s order code, then made the build flag the names you’d get wrong. What You Need Before … Read more >>

How to Create a GUID in C# (.NET 10 Examples + Video)

Create a GUID in C#: Guid.NewGuid() returns a version 4 GUID and Guid.CreateVersion7() a time-ordered version 7 GUID, 36 characters long

To create a GUID in C#, call Guid.NewGuid(). It gives you a random 128-bit value in the familiar 8-4-4-4-12 hex layout, so your code can make an order ID or database key without asking a server for the next number. On .NET 9 and later you also get Guid.CreateVersion7(), which puts a timestamp up front … Read more >>

C# Create Folder If Not Exists (Directory.CreateDirectory Guide)

C# create folder if not exists: Directory.CreateDirectory called twice on Reports202610-OctoberTexas with no exception

Want C# to create a folder only if it doesn’t exist? Call Directory.CreateDirectory(path). It creates the folder when it’s missing and quietly returns the existing one when it’s already there, so no check is needed. In this tutorial, I’ll cover every C# create folder if not exists case I run into: the current directory, folders … Read more >>