Results 1 to 17 of 17

Thread: What is different from a Delegate to a pointer?

Threaded View

  1. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: What is different from a Delegate to a pointer?

    Delegate is not a pointer by itself, but it describes a pointer.
    Delegate is just a way to describe the method's arguments and its return types (this in common is called method's signature).

    So, in order to invoke a method you not only need to know its address, but also the arguments it accepts and the return type. That's why you need a delegate.

    Basically, a delegate is a type that describes a method.

    So, to your second question. If you look closely at .NET Framework you'd understand that virtually everything IS a pointer here. (We call it reference though). There are two kinds of types though - reference types and value types, but this division is artificial. For example you can use IntPtr type instead of Int32 to work with pointers.

    Exactly because of the fact that we work with pointers (references) everywhere, the default keyword for passing arguments is ByVal, not ByRef - to protect data. With ByVal you pass a copy of your object, but with ByRef you pass a reference (a pointer) to your original object.

    And finally, there ARE left shift (<<) and right shift (>>) operators in vb.net

    Basically, when working with .NET Framework the choice of language is just a matter of syntax preferrence. If you are used to C-like syntax you can use C#, if you have a VB background - use VB.Net. They're completely interchangeable.

    This is how CLR works: Everything that can be made in C# can be made in VB also and vice versa.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width