C# Out params alternatives

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Callback idea
function action(soap, onSuccess) {
	if (soap === 4) onSuccess("foo", "bar")
}

action(4, (a, b)=> {})
ready
Return obj
function action(soap) {
	if (soap === 4) return ["foo", "bar"]
}

action(4)
ready
Obj Param
function action(soap, result) {
	if (soap === 4) {
		result.push("foo")
		result.push("bar")
	}
}
const res = []
action(4, res)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.