Consider the following:
Action<int, T> a1 = new Action<int, T>(_insert);
Action<int, T> a2 = new Action<int, T>(a1);
What is a2 referring to ? Is it a1, a shallow copy of a1 or is it a deep copy of a1 ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
a2is referencinga1. Here is the IL:At #1 the IL code is referencing
a1‘s Invoke method and the instancea1itself.A shallow copy would mean that the contents of
a1are copied, but nothing is being copied. The objecta1is treated as a black-box. Thereforea2will keepa1alive with respect to GC.