コード例 #1
0
 /// <summary>
 /// Converts an object to a string suitable from printing
 /// </summary>
 public static async Task <string> GetStringAsync(object?obj)
 {
     return
         (obj switch
     {
         Entity entity => entity.Serialize(),
         StringStream ss => await ss.GetStringAsync(),
         DateTime dt => dt.ToString(Constants.DateTimeFormat),
         double d => d.ToString(Constants.DoubleFormat, new NumberFormatInfo()),
         IArray array => array.NameInLogs,
         _ => obj?.ToString() !
     });