public static void Main()
var app = new Application { Description = "abc" };
var le = new LegalEntity { Name = "123" };
var list = new ObjectVertex[] { app, le };
foreach (var obj in list)
ObjectVertex a when a is Application app1 => app1.Description,
ObjectVertex a when a is LegalEntity le1 => le1.Name,
_ => "couldn't determine type"
Console.WriteLine("Hello World");
public class ObjectVertex {}
public class LegalEntity : ObjectVertex { public string Name { get; set; } }
public class Application : ObjectVertex { public string Description { get; set; } }