Presenter:Mike Taulty
Delegates and events are key features of .NET languages, and Visual Basic 9 will introduce some changes in how delegates can be used. We'll take a brief look at those changes in this session.
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
Oh and welcomed the stuff in a recession it is one in a series of short sessions will provide effeminate looking activities visual studio net framework minus like Tolkien working developer and platform group in Microsoft in the UK and this is one of a number of sessions around and propose changes to the Visual Basic language coming in version 9 and here a while to take a look at the feature that we ve got called relaxed delegates so I m sure that everyone is fully with the idea of a delegate and the way in which they used his change somewhat the really nice quite interesting change the language like several other than getting so in the eye visual studio 2005 I have a preview of the link technologies which gives me a preview of the VB 9 compiler and once is just get out and some anti classes so let s go straight ahead and have fast a placidly in a classy
Minute 1
Al Gore ahead and have been derived from a good speller and whether I have an ahead and has sea derived from me so now that I ve is delegate type selector ahead and affair delegates love but all is a delegate must rotate the parameter s a but I would be in the sea delegate as well trouble ahead and have fee and will have sea bee and see me got three delegate types and hurts us the go ahead and add three methods in here so will have sold little as a method will excuse me that has styled and the method must have sold see method and as you can spot I forgot that the parameters of years that have a has a graduate of parameter as a
Minute 2
Let how perilous as he must have treacherously and let s hope clearly what was revealed to do is declare and a delegate let s call it a house sample a little AD as an a delegate and I set it to the address golf day a method and similarly we can do the same forbidden sealers go ahead and do that to have fee and see pointing to their respective methods check that brokenness failure forgotten to change couple of any studies and sees and we make a good work so nothing very exciting going on there
Minute 3
And a delegate takes on a new delegate to its PC legacy to see and these methods are entirely compatible with that but what s interesting in the VB 9 language is that this at a delegate resolution of the light has been made a little bit more relaxed in terms of what is prepared to do for you so what have we got at the moment well at the delegate is a reference to a method that takes I be but we know that every p is also by definition a name because he derives from May so shouldn t we be able to take a second the delegate and pointed out the address off the aim method to compile
Minute 4
And in the version I m compiling we can do that and similarly we know that I see delegate is a reference to a method that cases seen well every day is also see every hazels was he so we should be able to go and declare see delegate number two as a see delegate takes the address of the game method and another see delegate that takes the address of the method we can compile that up and were fine and of course if we come to the iffy quadratic all these delegates left at Battersea to this one and the same one today we have capacity to a now elderly and invalidating archive safety or was saying is that if we ve got the delegate type that
Minute 5
Show like this one here then we should be able to point that any method that is compatible in terms of parameters and return types including parameters and return sites off the base classes of in our case to see and you could see the way it works now of course this also applies event handling cervical make ourselves very in Windows forms project was glad making the project will for Windows application is okay that wears drag about month the Sun form here go look at the code for the form he has our full now usually if he wanted to handle the button click event we go ahead and we declare ourselves some kind of handlers call this handler graduates wallets and button click
Minute 6
My sender as object arcs and has his own talents and only go single handedly but it is a wobbly just said we could have a bit more relaxed about listeners have answers object here and if we want to we can go ahead and say okay button one what is Riyadh handler button one click with the address of button and select an anxious five and because this handle is difficult than it is quite generic and everything is an object both parameters are objects with user and liberal kinds of things so control added we could go ahead and at the address of button click to that similar fine with the go ahead and use the same routine for drag and drop is wanted to
Minute 7
Is either we re now obviously where we get into this handle here we have try to decide what time the subject was that you can see that we are being a lot more relaxed about the kinds off routines that we can add as a handler to event because we allow the capability for derived sites to be passed over here and as he saw in the previous example just a quick summary for a scene there is today you are trying to point a delegate incidents at a particular method then the signature of the delegates in the signature of the method must match exactly in the denying that has been relaxed such that essentially the parameters and the return values of the method that you trying to find a delegate at last be obviously an exact match or they can be based classes of those that you re using in the signature
Minute 8
A delicate and was seen on the screen is a little bit complicated to say that you see on the screen so it means that it s it easier many ways to handle events and it was before because you can be much more flexible about the methods are used to handle those events like a feature of the language where can you go to a more information on VB 9 and language integrated query over the site and is the only consuming there on the screen and off that site you ll find a document that talks about the changes in the VB 9 language that are forthcoming about cities are not finished yet things could change anti feedback on this particular session feel free to mail me on just might got all the Microsoft com the councillors and council watching session and a
Click here to go to original video page
Wednesday, July 23, 2008
Video: VB9 - Relaxed Delegates
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment