0
이 코드를 작성하는 것이 더 좋은 방법일까요? 이 방법은 너무 복잡해 보입니다. anotherVariable
에 따라 example
값을 지정하고 싶습니다.C에서 익명 메소드를 호출하는 클리너 방식 #
var example = new Func<DateTime>((() =>
{
switch (anotherVariable)
{
case "Jesus birth": return new DateTime(0, 12, 24);
case "Second condition": return new DateTime(2017, 23, 11);
// etc
default: return DateTime.Now;
}
})).Invoke();
는
해당 사항이 있습니다. 감사! –