CKTIS / C#
System.Exception: practical reference
System.Exception: practical reference: Exception is the base of managed failures and carries Message, StackTrace, and an optional InnerException.
Version: .NET API; verified on .NET 10.0.14
Syntax
System.Exception /* select a documented member or constructor */Exception is the base of managed failures and carries Message, StackTrace, and an optional InnerException.
Throw a more specific type and add context without discarding the original inner exception.
Do not control program logic by Message text, and use throw rather than throw error to preserve the stack.
StackTrace can be null before throwing, and exception serialization is not a stable cross-system protocol.
The complete program actually uses System.Exception; its exact expected stdout is boom.
Examples
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
var error = new Exception("boom");
Console.WriteLine(error.Message);
Result
boom
The complete program actually uses `System.Exception`; its exact expected stdout is `boom`.