C# 4: Dynamic and Nullable<>
问题 So I've got some code that passes around this anonymous object between methods: var promo = new { Text = promo.Value, StartDate = (startDate == null) ? new Nullable<DateTime>() : new Nullable<DateTime>(DateTime.Parse(startDate.Value)), EndDate = (endDate == null) ? new Nullable<DateTime>() : new Nullable<DateTime>(DateTime.Parse(endDate.Value)) }; Methods that receive this anonymous object type declare its type as dynamic : private static bool IsPromoActive(dynamic promo) { return /* check