CSharp examples for Custom Type:Local Method
Local Method Variable Capture with Lambda
using System;/*from www . ja va2 s . com*/ using System.ComponentModel; class LocalMethodVariableCapture2 { static void Main() { DateTime now = DateTime.UtcNow; int hour = now.Hour; if (hour > 5) { int minute = now.Minute; PrintHourAndMinute(); void PrintHourAndMinute() => Console.WriteLine($"hour = {hour}; j = {minute}"); } } }