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. C#
  4. Operator[] index overload in C#

Operator[] index overload in C#

Scheduled Pinned Locked Moved C#
questioncsharpdatabasehelp
2 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.
  • A Offline
    A Offline
    al3xutzu00
    wrote on last edited by
    #1

    Hi Guys, I need to make an overload for the index operator[int x] for an System.Collection.ArrayList, to use the get/set methods on it to return/set the specific item in that list. How do i declare it ? i tried : public static explictit operator[int x] { } It doesn't work. Help. Kind regards, Alex

    “Be the change you want to see in the world.”

    C 1 Reply Last reply
    0
    • A al3xutzu00

      Hi Guys, I need to make an overload for the index operator[int x] for an System.Collection.ArrayList, to use the get/set methods on it to return/set the specific item in that list. How do i declare it ? i tried : public static explictit operator[int x] { } It doesn't work. Help. Kind regards, Alex

      “Be the change you want to see in the world.”

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      al3xutzu00 wrote:

      I need to make an overload for the index operator[int x]

      It isn't an operator. It is an indexer. You can read about how to create them here: Using Indexers (C# Programming Guide)[^]

      *Developer Day Scotland - Free community conference Delegate Registration Open

      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