public T Value { get; set; }
public string Foo { get; set;}
public static void Main()
var item1 = new Item<AlphaType> { Value = AlphaType.A1, Foo = "example 1" };
var item2 = new Item<BetaType> { Value = BetaType.B1, Foo = "example 2" };
public static void PrintAlphaFoo<T>(Item<T> item)
if (item.Value == AlphaType.A1)
Console.WriteLine(item.Foo);