将 var = ... firstOrDefault 显示为字符串而不是类型名

Displaying var = ... firstOrDefault as a string and not typename

如何格式化此 var 以显示返回的日期?

var lastDropStop = shipmentStatus.Stops.LastOrDefault(x => x.StopType.ToUpper() == "DROP");
debugFile.WriteLine("lastDropStop=" + lastDropStop.ToString());

我看到的不是日期,而是类型名称:

lastDropStop=MyComp.Outbound.Business.Entities.Models.ShipmentStatusStop

你正在打印对象,你也应该这样写属性名称

debugFile.WriteLine("lastDropStop=" + lastDropStop.StopType.ToString()); // or lastDropStop.LastDropStop.ToString() or whatever the property name is