using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
List<MarketModel> marketList = GetMarketList();
var market = marketList.FirstOrDefault(m => m.Code.Equals("ABC"));
Console.WriteLine("market is fetched");
if (market is { Exchange: { } })
Console.WriteLine($"market is null");
Console.WriteLine("Done");
public ExchangeModel Exchange { get; set; }
public long? ExchangeId { get; set; }
public string Code { get; set; }
public class ExchangeModel
public long ExchangeId { get; set; }
public string Name { get; set; }
private static List<MarketModel> GetMarketList()