Results for “dot”
Small, practical examples. Search by task or narrow things down below.
Pad a numeric label to a fixed width
C#: Use a numeric format specifier to add leading zeroes.
C#✓ Tested
Pair corresponding collection elements
C#: Zip stops at the shorter sequence, so validate lengths separately if mismatches are an error.
C#✓ Tested
Parse a date without a time component
C#: DateOnly avoids attaching an irrelevant time or timezone to a calendar date.
C#✓ Tested
Parse a GUID without an exception
C#: TryParse reports malformed values with a boolean return.
C#✓ Tested
Parse an enum name without throwing
C#: Combine TryParse and IsDefined when only named declared values should be accepted.
C#✓ Tested
Pass behavior as a function delegate
C#: Func describes a callable with typed parameters and a return value.
C#✓ Tested
Perform cleanup even after an exception
C#: A finally block runs after a handled failure as well as after success.
C#✓ Tested
Print a number with two decimal places
C#: Format a small decimal value consistently for display.
C#✓ Tested
Process a FIFO queue
C#: Queue removes elements in the order they were enqueued.
C#✓ Tested
Process a file as a lazy line sequence
C#: ReadLines avoids allocating one string containing the entire file.
C#✓ Tested
Process items by numeric priority
C#: PriorityQueue removes the item with the smallest priority value first.
C#✓ Tested
Provide a fallback for a nullable value
C#: The null-coalescing operator supplies a default only when the left side is null.
C#✓ Tested