CKTIS / C#
System.StringComparison: practical reference
System.StringComparison: practical reference: StringComparison specifies the exact semantics of a string comparison.
Version: .NET API; verified against .NET 10 reference surface
Syntax
System.StringComparison /* select a documented member or constructor */StringComparison specifies the exact semantics of a string comparison.
Pass an explicit StringComparison because defaults are method-specific: String.Equals defaults to Ordinal, while string.StartsWith(string) and string.IndexOf(string) default to CurrentCulture.
Ordinal and culture-sensitive comparisons solve different security and UI problems.
IgnoreCase does not normalize characters, and culture rules can change.
The complete program actually uses System.StringComparison; its exact expected stdout is True.
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;
Console.WriteLine("CKTIS".StartsWith("ck", StringComparison.OrdinalIgnoreCase));
Result
True
The complete program actually uses `System.StringComparison`; its exact expected stdout is `True`.