Delegates
Learn delegates and I can't find any information about the following thing:
1. Why when we declare an instance of delegate with its name in class we can't provide it with one more method outside of its declaration? But it works in method as we can see,
2. Why we CAN add method in an instance of delegate during its declaration?
Screenshot and code itself
I want to completely understand why it is so
7 Replies
2. for the same reason you cant do i = 5; outside of a function
im not sure what you mean in 1
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
ill also note that initializing fields does count as code execution, but its kind of an exception
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
behind the scenes in the compiled code, its done in the (generated) ctor
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View