Results for “C#”
Small, practical examples. Search by task or narrow things down below.
Restore the working location after an operation
PowerShell: Push-Location and Pop-Location manage a directory stack; finally ensures restoration.
PowerShell✓ Tested
Restrict a diff to one chosen path
Git: Use the double dash separator to distinguish a filename from revisions or options.
Git✓ Tested
Restrict a function parameter to known choices
PowerShell: ValidateSet rejects unsupported values before the function body executes.
PowerShell✓ Tested
Retrieve a file from a stopped container
Docker / Compose: The writable layer remains available for docker cp after exit.
Docker / Compose✓ Tested
Retrieve the result of an asynchronous task
C++: The explicit async launch policy requests asynchronous execution rather than deferred evaluation.
C++✓ Tested
Return a collection as one pipeline object
PowerShell: The unary comma prevents the returned array from being enumerated at this boundary.
PowerShell✓ Tested
Return a descriptive validation error
Return a descriptive validation error using a complete Go program with explicit sample inputs.
Go✓ Tested
Return a small immutable named record
Python: Use NamedTuple when callers need both tuple behavior and named fields.
Python✓ Tested
Return a status separately from a calculated result
C: An output pointer lets a function return success or failure independently of its numeric result.
C✓ Tested
Return a value from a switch expression
Java: Use an exhaustive switch expression with a fallback for other input values.
Java✓ Tested
Return text from a shell function
Capture a function’s output with command substitution.
function✓ Tested
Return the first item with a generic function
Preserve the element type while allowing empty arrays.
generics✓ Tested