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
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. MC++ indexed properties and C#

MC++ indexed properties and C#

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++databasehelp
4 Posts 3 Posters 2 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
    Paul Selormey
    wrote on last edited by
    #1

    Hello All, I have a project in MC++ consisting of several components/controls. Many parts used indexed properties. These are recognized in VB.NET as properties, and shows in the VB.NET code browser as such. However, in C#, the indexed properties are seen as methods; get_Item/set_Item instead of the Item property in the following:

    __property String __gc* get_Item(Int32 index)
    {
    }
    __property void set_Item(Int32 index, String __gc* value)
    {
    }

    Is this a known problem? is there anyway to work around it? It is becoming very difficult to document our components. Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.

    N 1 Reply Last reply
    0
    • P Paul Selormey

      Hello All, I have a project in MC++ consisting of several components/controls. Many parts used indexed properties. These are recognized in VB.NET as properties, and shows in the VB.NET code browser as such. However, in C#, the indexed properties are seen as methods; get_Item/set_Item instead of the Item property in the following:

      __property String __gc* get_Item(Int32 index)
      {
      }
      __property void set_Item(Int32 index, String __gc* value)
      {
      }

      Is this a known problem? is there anyway to work around it? It is becoming very difficult to document our components. Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      Hi Paul Put [ DefaultMember( "Item" ) ] before your class declaration Regards, Nish p.s. I answered this in the newsgroup too (then saw this post and confirmed that you and he are the same :-)) p.s. #2 - I posted this here too so you'll find it earlier :-)


      "I'm a bit bored at the moment so I'm thinking about writing a new programming language" - Colin Davies My book :- Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]

      P 1 Reply Last reply
      0
      • N Nish Nishant

        Hi Paul Put [ DefaultMember( "Item" ) ] before your class declaration Regards, Nish p.s. I answered this in the newsgroup too (then saw this post and confirmed that you and he are the same :-)) p.s. #2 - I posted this here too so you'll find it earlier :-)


        "I'm a bit bored at the moment so I'm thinking about writing a new programming language" - Colin Davies My book :- Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]

        P Offline
        P Offline
        Paul Selormey
        wrote on last edited by
        #3

        Thanks. Nishant S wrote: p.s. I answered this in the newsgroup too (then saw this post and confirmed that you and he are the same ) Read that too. Andre claims it is a bug. It works with VB.NET without marking it as DefaultMember. I do not know when the MC++ team will have put a real working compiler for .NET - it is still too buggy ;P BTW, should it be DefaultMember or DefaultProperty? Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.

        V 1 Reply Last reply
        0
        • P Paul Selormey

          Thanks. Nishant S wrote: p.s. I answered this in the newsgroup too (then saw this post and confirmed that you and he are the same ) Read that too. Andre claims it is a bug. It works with VB.NET without marking it as DefaultMember. I do not know when the MC++ team will have put a real working compiler for .NET - it is still too buggy ;P BTW, should it be DefaultMember or DefaultProperty? Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.

          V Offline
          V Offline
          VizOne
          wrote on last edited by
          #4

          Paul Selormey wrote: Andre claims it is a bug Well, I did not say it is a bug. All I said was that a) As DefaultMember makes the property in question the indexer for C# (e.g. public string this[int index]{get; set;} ), there can be only one indexed property in C# b) The way the indexer is accessed (instance[5] instead of what on expect for a indexed property instance.MyProp[5]) makes the class look array-like. So, after all, it is not a missing feature in MC++ (which supports indexed properties), but more of a missing feature in the C# specifications. (BTW. it is System.Reflection.DefaultMemberAttribute) Best regards, Andre P.S.: damn, i hate it when I have to rewrite the whole post just because I forgot to log in :)

          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