Results 1 to 3 of 3

Thread: [RESOLVED] private property of list of string will also display on calling object

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Resolved [RESOLVED] private property of list of string will also display on calling object

    Hi.
    Code:
       <DataContract(), KnownType(GetType(List(Of String))), XmlSerializerFormat()>
        <Serializable()>
        Public Class setorder
    '.......
      <DataMember()>
            Public Property seats As List(Of String)
                Get
                    Return m_seats
                End Get
                Set(value As List(Of String))
                    m_seats = value
                End Set
            End Property
            <DataMember()>
            Private m_seats As List(Of String)
    end class
    When i call this from another program (the above is part of a wcf service):
    Code:
    dim vc as new setorder
    setorder.seats.Add("H3")
    ''''''''''
    setorder.m_seats '(  system collection generic list of string) !!
    How is it possible that a private property is shown in the client application?!
    Does the initial serializations play a part on this?
    How can i hide it?
    Thanks.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  2. #2

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: private property of list of string will also display on calling object

    I've set this as Protected Friend m_seats As List(Of String)
    but i still don't understand why it will show in the first place.
    Any opinions?

    EDIT! Nop it will still show!
    Last edited by sapator; Feb 18th, 2015 at 04:44 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: private property of list of string will also display on calling object

    <DataMember()>
    Private m_seats As List(Of String)

    Solved. I've wrongly set it as datamember. Super blind mode on!
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

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