Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how to pass parameters to a delegate

how to pass parameters to a delegate

Scheduled Pinned Locked Moved C#
questiontutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prasadbuddhika
    wrote on last edited by
    #1

    for cross thread communication i use a delegate and the method registered with the delegate takes a parameter.how can i pass this parameter to the method through the delegate?

    S 1 Reply Last reply
    0
    • P prasadbuddhika

      for cross thread communication i use a delegate and the method registered with the delegate takes a parameter.how can i pass this parameter to the method through the delegate?

      S Offline
      S Offline
      Shyam K Pananghat
      wrote on last edited by
      #2

      You can pass it just like in a method call.. Delegate is actually hloding a method pointer.

      Shyam.. My Blog dotnetscoups.blogspot.com

      P 1 Reply Last reply
      0
      • S Shyam K Pananghat

        You can pass it just like in a method call.. Delegate is actually hloding a method pointer.

        Shyam.. My Blog dotnetscoups.blogspot.com

        P Offline
        P Offline
        prasadbuddhika
        wrote on last edited by
        #3

        thanks, i get the way..

        this.invoke("delegatename","parameters");

        S 1 Reply Last reply
        0
        • P prasadbuddhika

          thanks, i get the way..

          this.invoke("delegatename","parameters");

          S Offline
          S Offline
          Shyam K Pananghat
          wrote on last edited by
          #4

          If you have the delegate localy.. say delegatename is your delegate then call it like delegatename("parameters")..

          Shyam.. My Blog dotnetscoups.blogspot.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups