private void WriteGraph(ref GraphContext context) { if(context.TypeCode == ObjectTypeCode.Object) { AssertGraphHasNotBeenSeen(context.Graph); WriteComplex(ref context); } else { WritePrimitive(ref context); } }