FIND YOUR NEXT FEW LINES

Results for “Object behavior & collections”

Small, practical examples. Search by task or narrow things down below.

631 snippets foundClear filters
PowerShellHashtables & object records

Check for a hashtable key before reading it

PowerShell: ContainsKey distinguishes a missing key from a key whose value happens to be null.

PowerShell✓ Tested
HTMLForm behavior

Choose a local file through a labeled control

HTML: A file input exposes selected file metadata to the page without providing arbitrary filesystem access.

HTML✓ Tested
HTMLForm behavior

Collect several checked values under one name

HTML: Only checked named checkboxes become successful form controls.

HTML✓ Tested
PowerShellHashtables & object records

Construct a record with named properties

PowerShell: PSCustomObject gives downstream pipeline commands meaningful property names.

PowerShell✓ Tested
GoSlices & collections

Copy a slice without sharing storage

Copy a slice without sharing storage using a complete Go program with explicit sample inputs.

Go✓ Tested
GoSlices & collections

Deduplicate sorted values

Deduplicate sorted values using a complete Go program with explicit sample inputs.

Go✓ Tested
HTMLForm behavior

Disable a related group of controls

HTML: A disabled fieldset prevents editing its descendant controls and omits them from form submission.

HTML✓ Tested
PowerShellHashtables & object records

Enumerate hashtable entries in a stable order

PowerShell: Sort entries by key when predictable output matters.

PowerShell✓ Tested
GoSlices & collections

Filter values into a new slice

Filter values into a new slice using a complete Go program with explicit sample inputs.

Go✓ Tested
GoSlices & collections

Find an item’s index

Find an item’s index using a complete Go program with explicit sample inputs.

Go✓ Tested
C#Collections & data structures

Find values missing from another collection

C#: Except removes duplicates as it calculates the set difference.

C#✓ Tested
CSSVisual treatment & accessibility

Fit an entire image inside a differently shaped box

CSS: Contain preserves the image aspect ratio while keeping all of it visible inside the specified content box.

CSS✓ Tested