Results for “dot”
Small, practical examples. Search by task or narrow things down below.
Check a literal prefix with ordinal comparison
C#: Choose StringComparison.Ordinal when a prefix is a protocol token rather than culture-dependent text.
C#✓ Tested
Check an extension without case sensitivity
C#: Use an explicit ordinal case-insensitive comparison for a known filename suffix.
C#✓ Tested
Choose between two branches
C#: Use if and else to handle an available or empty stock count.
C#✓ Tested
Clamp a number to inclusive bounds
C#: Math.Clamp returns the nearest endpoint when the value lies outside the range.
C#✓ Tested
Combine collections as a distinct set
C#: Union retains each value once across both inputs.
C#✓ Tested
Combine text with a name
C#: Construct a greeting from a fixed prefix and a stored name.
C#✓ Tested
Compare a value with a limit
C#: Turn a comparison into a readable yes or no result.
C#✓ Tested
Convert a timestamp to a different fixed offset
C#: ToOffset changes the displayed local time while retaining the same instant.
C#✓ Tested
Convert bytes to Base64 and back
C#: Encode text to UTF-8 before converting it to a Base64 representation.
C#✓ Tested
Convert known numeric text to an integer
C#: Convert a trusted literal to an integer before adding. Validate external input before converting it.
C#✓ Tested
Convert Unix seconds to an offset-aware timestamp
C#: DateTimeOffset preserves the UTC offset explicitly.
C#✓ Tested
Copy a file without overwriting
C#: File.Copy defaults to refusing a destination that already exists.
C#✓ Tested