Results 1 to 6 of 6

Thread: Indexers in C sharp

  1. #1
    Join Date
    Dec 2009
    Posts
    37

    Indexers in C sharp

    Hello Guys,

    I am getting lots of troubles while understanding the 'Indexers' concept of C sharp. For me it's seems very complicated to understand. I also don't know for what purpose the 'Indexers' are being used in C sharp programming language. If anybody of you have the sound knowledge about the 'Indexers' in C sharp, then please share you knowledge with me. I would greatly appreciate your any help over this.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Indexers in C sharp

    The indexers in C sharp are normally referred as smart arrays. C sharp introduces entirely a new concept of Indexers and which are used for treating an object as an array.In short Indexer is a member which enables an class object to be indexed in the same way as an array. The formal argument list in C sharp specifies the parameters of Indexer ind C sharp. Defining a C sharp indexer is similar to define properties.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Indexers in C sharp

    The element type in C sharp is not part of signature of the c sharp indexer and it is also not the part of the informal parameters.The indexers in C sharp can be overloaded just like member functions.If we declare an indexer static,the compiler will show a compilation time error. C sharp do not have the concept of static indexers. The signature of an indexer must differ from the signatures of all other indexers declared in the same class.The formal parameter list of an indexer defines the signature of the indexer. Specifically, the signature of an indexer consists of the number and types of its formal parameters.

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Indexers in C sharp

    Indexers in C sharp language can be overloaded in program. The 'this' keyword of C sharp is used to define the C sharp indexers. In C sharp Indexers doesn't have to be indexed by an integer value;i.e it is up to us how to define the specific look-up mechanism. Indexers enable objects to be indexed in a similar manner to arrays.Indexers can have more than one formal parameter, for example, when accessing a two-dimensional array.The value keyword is used to define the value being assigned by the set indexer

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Indexers in C sharp

    If you want to know about the C sharp indexers, then refer the following example. Using the 'this' keyword the C sharp indexers are defined, see below:
    class Mlass1
    {
    private int[,] mint1 = new int[150,150];

    public int this[int i1, int j1]

    {
    get
    {
    return mint[i1, j1];
    }
    set
    {
    mint[i1, j1] = value1;
    }
    }
    }

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    Re: Indexers in C sharp

    Indexers Concept in C sharp programming is nothing but one type of object which act as an array. Indexer modifier type can be public, private, internal or protected.This is very essential for some conditions to define the modifier for Indexers. Let as discuss something about Indexer. Indexers in C sharp must have at least one parameter. The return type can be any valid C sharp types. Indexer an object to be indexed in the same way as an array. In C sharp it is possible to overload the Indexers

Similar Threads

  1. Sharp 007SH Hybrid An 3D Clamshell Android Phone by Sharp
    By jackalz in forum Web News & Trends
    Replies: 3
    Last Post: 22-05-2011, 07:28 AM
  2. C sharp v/s C plus plus
    By GlassFish in forum Software Development
    Replies: 3
    Last Post: 30-01-2011, 07:06 AM
  3. What are the features of C Sharp?
    By Prashobh Mallu in forum Software Development
    Replies: 5
    Last Post: 02-02-2010, 02:49 PM
  4. Use of delegates in C sharp
    By opaper in forum Software Development
    Replies: 5
    Last Post: 25-01-2010, 01:44 PM
  5. What is meaning for Indexers in C# ?
    By Flacos in forum Software Development
    Replies: 3
    Last Post: 10-11-2009, 07:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,529,670.88101 seconds with 16 queries