コード例 #1
0
        public void UnsafeClosureUsingLocalVariable()
        {
            string safeSource = UnsafeSource();

            AnonymousMethodSample.FragmentParameterDelegate fragmentDelegate =
                delegate { return(RequiresClosureFragment(safeSource)); };
            fragmentDelegate("safe", "safe");
        }
コード例 #2
0
 public void UnsafeClosureUsingField()
 {
     AnonymousMethodSample.FragmentParameterDelegate fragmentDelegate =
         delegate { return(RequiresClosureFragment(_unsafeField)); };
     fragmentDelegate("safe", "safe");
 }