Indexer is for accessing a list of value.
Indexer is accessed by using the index.
The following code uses the indexer from buildin type string to access each char inside a string.
using System;
class Program
{
static void Main(string[] args)
{
string str = "java2s.com";
Console.WriteLine(str[2]);
}
}
The output:
v
| w__w_w__.___j_a__v___a2___s_.___c___om__ | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |