C# Commands
The main .NET language.All C# pages
- c# convert string to int: int.Parse vs int.TryParse vs Convert.ToInt32Convert a string to int in C# with int.TryParse (no exception), int.Parse or Convert.ToInt32. How each handles null, spaces, decimals, overflow and culture.
- c# read a text file line by line (File.ReadLines vs File.ReadAllLines)Read a text file line by line in C# with File.ReadLines (lazy) or File.ReadAllLines (array). Line endings, encodings, StreamReader, async reading and paths.
- c# sort a list of objects by property (OrderBy, ThenBy, List.Sort)Sort a List of objects by a property in C# with LINQ OrderBy, OrderByDescending and ThenBy, or in place with List.Sort. Stability and case-insensitive order.
- dotnet run app.cs: run a C# file without a project (.NET 10 file-based apps)Run a single C# file without a .csproj using dotnet run app.cs (.NET 10 file-based apps). Arguments after --, #:package and #:property directives, and pitfalls.