Skip to content

JSReference.TryCreateReference method

Creates a reference to a JS value, if the value is an object, function, or symbol.

C#
public static bool TryCreateReference(JSValue value, bool isWeak, out JSReference? result)
parameterdescription
valueThe JS value to reference.
isWeakTrue to create a weak reference, false to create a strong reference.
resultReturns the created reference, or default(JSValue), equivalent to undefined, if the value is not a referencable type.

Return Value

True if the reference was created, false if the reference could not be created because the value is not a supported type for references.

See Also

Released under the MIT license