C # 7 introduced local functions (which is great!). Suppose I have the following code:
using System; using PostSharp.Aspects; namespace AspectCS7 { class Program { private static void Main() { [MyAspect] void LocalFunction() { Console.WriteLine("Hello Aspect!"); } LocalFunction(); } } [Serializable] public class MyAspect : OnMethodBoundaryAspect { public override void OnEntry(MethodExecutionArgs args) { Console.WriteLine("Entering Aspect"); } } }
This code shows compile-time errors. Can attributes be applied to local functions?
source share