Why TryParse Can't Get Property?

Last post 07-22-2006 10:14 AM by engeleng. 2 replies.

Sort Posts:

  • Why TryParse Can't Get Property?

    07-22-2006, 4:53 AM
    • Member
      30 point Member
    • engeleng
    • Member since 04-08-2004, 8:33 AM
    • Posts 6
       I search the web without success to get some answer to this question:
    if i'm using the method TryParse(string, out property) and giving it property as out member i get the error "A property or indexer may not be passed as an out or ref parameter"
    i tried to understand why...,why i must give the method a variable and it can not get property of the variable?

    thank you in advnace
    Dror.
  • Re: Why TryParse Can't Get Property?

    07-22-2006, 8:55 AM
    • Participant
      860 point Participant
    • JasonFollas
    • Member since 06-02-2005, 6:13 PM
    • 41.501000, -83.718000
    • Posts 170

    The fact that a property looks and feels like a variable is deceiving. When compiled, a property becomes two methods: one for the Getter and one of the Setter.  This is why the property fails when you try to use it in TryParse().

     

  • Re: Why TryParse Can't Get Property?

    07-22-2006, 10:14 AM
    • Member
      30 point Member
    • engeleng
    • Member since 04-08-2004, 8:33 AM
    • Posts 6
    you right, thanks!
Page 1 of 1 (3 items)