FIND YOUR NEXT FEW LINES

Results for “method”

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

17 snippets foundClear filters
C#Asynchronous work & URI handling

Await an asynchronous method result

C#: Use Task<T> for an async operation with a typed result.

C#✓ Tested
AngularGetting Started

Call a component method from an event

Call a component method from an event with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
RustFunctions & data types

Implement a method on a struct

Implement a method on a struct in a complete Rust program using the standard library.

Rust✓ Tested
C#Types & reliable control flow

Return multiple named values from a method

C#: Named value tuples give lightweight field names without a separate class.

C#✓ Tested
C#Types & reliable control flow

Validate an argument at a method boundary

C#: ThrowIfNegative gives callers an explicit argument error for an invalid range.

C#✓ Tested
GoFunctions & types

Attach behavior to a struct

Attach behavior to a struct using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFunctions & types

Mutate a struct through a pointer receiver

Mutate a struct through a pointer receiver using a complete Go program with explicit sample inputs.

Go✓ Tested
JavaPrecise numeric calculations

Display an integer as unsigned

Java: Use unsigned conversion methods when interpreting a fixed-width bit pattern.

Java✓ Tested
JavaScriptObject behavior & collections

Distinguish an own property from an inherited one

JavaScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.

JavaScript✓ Tested
TypeScriptObject behavior & collections

Distinguish an own property from an inherited one

TypeScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.

TypeScript✓ Tested
jQueryDeferred work & queues

Expose observation without exposing resolution

jQuery: promise returns an interface without resolve or reject methods.

jQuery✓ Tested
TypeScriptCollections & records

Filter and transform an array

Keep active objects and extract their names.

filter✓ Tested