@@ -63,25 +63,37 @@ public static Serializer FromValueSerializer(IValueSerializer valueSerializer, E
6363 }
6464
6565 /// <summary>
66- /// Serializes the specified object.
66+ /// Serializes the specified object into a string .
6767 /// </summary>
68- /// <param name="writer">The <see cref="TextWriter" /> where to serialize the object.</param>
6968 /// <param name="graph">The object to serialize.</param>
70- public void Serialize ( TextWriter writer , object ? graph )
69+ public string Serialize ( object ? graph )
7170 {
72- Serialize ( new Emitter ( writer , emitterSettings ) , graph ) ;
71+ using var buffer = new StringWriter ( ) ;
72+ Serialize ( buffer , graph ) ;
73+ return buffer . ToString ( ) ;
7374 }
7475
7576 /// <summary>
7677 /// Serializes the specified object into a string.
7778 /// </summary>
7879 /// <param name="graph">The object to serialize.</param>
79- public string Serialize ( object ? graph )
80+ /// <param name="type">The static type of the object to serialize.</param>
81+ public string Serialize ( object ? graph , Type type )
8082 {
8183 using var buffer = new StringWriter ( ) ;
82- Serialize ( buffer , graph ) ;
84+ Serialize ( buffer , graph , type ) ;
8385 return buffer . ToString ( ) ;
8486 }
87+
88+ /// <summary>
89+ /// Serializes the specified object.
90+ /// </summary>
91+ /// <param name="writer">The <see cref="TextWriter" /> where to serialize the object.</param>
92+ /// <param name="graph">The object to serialize.</param>
93+ public void Serialize ( TextWriter writer , object ? graph )
94+ {
95+ Serialize ( new Emitter ( writer , emitterSettings ) , graph ) ;
96+ }
8597
8698 /// <summary>
8799 /// Serializes the specified object.
0 commit comments