TryWriteReference(Object?) Method

Definition

Assembly SharpYaml.dll

Attempts to preserve object references by writing an alias when value was previously anchored, or by writing an anchor for the next value when it is seen for the first time.

public bool TryWriteReference(object? value)

Parameters

value
Object

The value to track.

Returns

Boolean
true when an alias was written and no further output for this value is required.

Remarks

This method is intended for use by generated serializers and custom converters. It is a no-op unless ReferenceHandling is Preserve.