using System;
using SmartFormat;
public class Point
{
public double? Lat { get; set; }
public double? Lon { get; set; }
}
public class Program
public static void Main()
var point = new Point {Lat = 23.45};
Console.WriteLine(Smart.Format("Latitude: {Lat:choose(null):N/A|{}}, longitude: {Lon:choose(null):N/A|{}}", point));
// Output is:
// Latitude: N/A, longitude: N/A
// Output I want is:
// Latitude: 23.45, longitude: N/A