CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Location
    Israel
    Posts
    113

    Question How to define a delegate that will have the form a property?

    I wand to define a delegate that will have the form a property and not a method.

    Let say I have a property:
    Code:
     
    public int myProp
    {
    	get { return 0; }
    	set {}
    }

    And I want to have a delegate that will take this property as the handler.

    Is it possible?
    How do I do that?

    -----------------------
    Thanks in advance
    Sharon

  2. #2
    Join Date
    Dec 2003
    Location
    http://map.search.ch/zuerich.en.html
    Posts
    1,074

    Re: How to define a delegate that will have the form a property?

    Is it possible?
    No!

    A delegate expects a target and a method to invoke on it.

    A property is syntatic sugar for get_Property and set_Property, however, new CustomDelegate(this.get_Property) is not allowed by the compiler.
    Useful? Then click on (Rate This Post) at the top of this post.

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

Featured