C# Reference - C# Indexers - Indexer - C# Reference - C# Indexers - Indexer
The LBTT Spot
"Lifeline is focused on developing and marketing systems designed to assist in the early detection of breast and ovarian cancer."



C# Reference - C# Indexers - Indexer

View C# Source Code

Article Categories:

.Net Framework
.Net Framework 1.1
ADO.NET
ASP.NET
Assemblies
Asynchronous Methods
C#
Collections
Configuration
Delegates
Events
Pocket PC
Regular Expressions
Smart Devices
SQL Server
Visual C#
Visual Studio .NET
Visual Studio .NET 2003
Windows Forms
XML

C# .Net Fun Menu

View Current Page's ASP.NET Source Code
C# Reference
C# Study Flash Cards
Valuable Links
Contact Us
Site Map
Mike's Portfolio

C# Reference Search:

Full Text Search:

Articles by Author:

Code Examples (zipped):

C# Reference
      C# Indexers
           Indexer


  • C# Indexers: [Indexer] Reference from Microsoft®


  • Indexers provide collection/array type access to data via a class instance. using System.Collections; public class myClass { private ArrayList al = new ArrayList(); // this is the indexer: String this [int Index] { get { return al[Index].ToString(); } set { if (al.Contains(value)) al[Index] = value; else al.Insert(Index, value); } } // using the indexer public void Main() { this[0] = "My String #1"; this[1] = "My String #2"; Console.WriteLine(this[0] + this[1]); // the result would be My String #1My String #2 } }