Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I pass Event mechanism in MS, locking send / publish notification .I do not pass Concurrent Collection yet. Consider, as definition ask, Events as a certain particular type of Delegates.When invoke declared Delegate,the correspondent method is invoked.Assume that invocation is made for Annonymous Methods, but - code for method is recommanded to be expressed much more as Lambda Expression, Closures and Functors.- .So,I consider evaluating Closures with SystemReflection namespace.Intuitvly seems that SystemReflection offer all need stuff for this.Can Closures be somehow different evaluated?
Posted
Comments
Sergey Alexandrovich Kryukov 11-Aug-13 0:15am    
What is "pass even mechanism in MS"?! "Invoke declared Delegate"? "Method is recommanded"? "Evaluating Closures"? And so on...
It all leaves a strong impression of schizophasia, as if you had no idea what you are asking about.
Even if there is some rational grain in what you are trying to do, you are too far from expressing it in any conventional system of concepts.
—SA
BillWoodruff 11-Aug-13 6:31am    
What specifically are you trying to do here ? What technical context is this question asked in: what libraries in C# are you using. What have you tried so far.

1 solution

You don't understand what a closure is, so this question makes no sense at all, as well as your goal.

Closure is not something which can be "evaluated". This is a union of a function with its reference environment. The essence of it is to allow the delegate to access the local variables even after the code creating the delegate instance goes out of the scope. In other words, closure is not some particular object you can obtain or access, this is, at the level of its implementation, a set of internal structures which supports the conception technically. You can read about it here: http://en.wikipedia.org/wiki/Closure_%28computer_science%29[^].

If you have some local (stack) variable which is referenced by some anonymous delegate instance, the code related to access to this variable is modified the way to provide access to its object for all the time when reachability of that delegate instance is kept in the application.

It's very easy to demonstrate the effect of a closure on a .NET example, but I'm not sure if you need that.

—SA
 
Share this answer
 
v3
Comments
BillWoodruff 11-Aug-13 6:44am    
Excellent answer, even if what the OP is asking cannot be understood :)

I'd really appreciate seeing an article on CP giving an overview of scope and persistence when using anonymous delegates, and other objects. And the relevance of the computer science concept of "closure" to C#, in theory, and practice.
Sergey Alexandrovich Kryukov 11-Aug-13 11:52am    
Thank you, Bill.

It would be a great topic which I'm almost ready to cover to certain extent, as I thought about such article. So far, I only published a short section "On the nature of delegate instances" in my article on Dynamic Method Dispatcher. The main problem is: I already have full source code for two other articles which are waiting in a queue to be written...

—SA
BillWoodruff 12-Aug-13 11:16am    
Well, SA, I still have a few years left, so waiting's not a problem for me. I do hope in your future articles you will keep in mind that, for some of us here, we may fit into the category implied by Marcus Aurelius, when he said: "Natural ability without education has more often raised a man to glory and virtue than education without natural ability." Just substitute "person" for "man" (to be politically correct); "sometimes" for "more often;" and, substitute "some level of technical understanding, and competence" for "glory and virtue" :) yours, Bill
Sergey Alexandrovich Kryukov 12-Aug-13 11:27am    
Great.
(However, I would ask comrade Aurelius where that natural ability comes from. I have some ideas about it myself. :-)
Thank you, Bill.
—SA
BillWoodruff 12-Aug-13 13:34pm    
I would trade a portion of my "soul" to have the chance to know Comrade Aurelius (knowing that knowing him would increase my soul far more, in quality, than it had before I gave away a portion of it). I'd like to learn from him what the inner qualities were that enabled him to experience both these "realities" simultaneously:

"The sexual embrace can only be compared with music and with prayer."

"Death is a release from the impressions of the senses, and from desires that make us their puppets, and from the vagaries of the mind, and from the hard service of the flesh."

I have ideas some about that, myselves :)

yours, Bill

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900