src/Orleans.Serialization/Codecs/ReferenceCodec.cs
/// <summary>
/// Write an object reference if <paramref name="value"/> has already been written and has been tracked via <see cref="RecordObject(SerializerSession, object)"/>.
/// </summary>
/// <typeparam name="TBufferWriter">The buffer writer type.</typeparam>
/// <param name="writer">The writer.</param>
/// <param name="fieldId">The field identifier.</param>
/// <param name="expectedType">The expected type.</param>
/// <param name="value">The value.</param>
/// <returns><see langword="true" /> if a reference was written, <see langword="false" /> otherwise.</returns>
Write an object reference if  has already been written and has been tracked via .
Write an object reference if has already been written and has been tracked via .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static bool TryWriteReferenceField<TBufferWriter>(
            ref Writer<TBufferWriter> writer,
            uint fieldId,
            Type expectedType,
            object value) where TBufferWriter : IBufferWriter<byte>
        {
            if (!writer.Session.ReferencedObjects.GetOrAddReference(value, out var reference))
            {
                return false;
            }
            writer.WriteFieldHeader(fieldId, expectedType, value?.GetType(), WireType.Reference);
            writer.WriteVarUInt32(reference);
            return true;
        }
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ] public static bool TryWriteReferenceField < TBufferWriter > ( ref Writer < TBufferWriter > writer , uint fieldId , Type expectedType , object value ) where TBufferWriter : IBufferWriter < byte > { if ( ! writer . Session . ReferencedObjects . GetOrAddReference ( value , out var reference ) ) { return false ; } writer . WriteFieldHeader ( fieldId , expectedType , value ? . GetType ( ) , WireType . Reference ) ; writer . WriteVarUInt32 ( reference ) ; return true ; }
Write an object reference if  has already been written and has been tracked via .
Write an object reference if has already been written and has been tracked via .
if a reference was written,  otherwise.
if a reference was written otherwise .
Writer<TBufferWriter>
ref
fieldId
uint
The field identifier.
The field identifier .
expectedType
Type
The expected type.
The expected type .
value
object
None
writer
None
typeparam
The buffer writer type.
The buffer writer type .