Tutorials
Resources
Forum
Reviews
Communities
Interview
Jobs
Projects
Training
Your
Ad
Here
Silverlight Games
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Polls
|
Revenue Sharing
|
Lobby
|
Gift Shop
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Alwyn
(200)
Asheej T K
(102)
Avinash Mohan
(90)
Last 7 Days
Alwyn
(938)
Asheej T K
(525)
nishithraj
(523)
more...
Resources
»
Code Snippets
»
C# Syntax
»
Indexer in C#
Posted Date: 20 Nov 2008
Resource Type:
Code Snippets
Category:
C# Syntax
Author:
Santhi
Member Level:
Gold
Rating:
Points
: 3
using System;
class IntIndexer
{
private string[] myData;
public IntIndexer(int size)
{
myData = new string[size];
for (int i=0; i < size; i++)
{
myData[i] = "empty";
}
}
public string this[int p]
{
get
{
return myData[p];
}
set
{
myData[p] = value;
}
}
static void Main(string[] args)
{
int size = 10;
IntIndexer myIndex = new IntIndexer(size);
myIndex[9] = "Some Value";
myIndex[3] = "Another Value";
myIndex[5] = "Any Value";
Console.WriteLine("\nOutput:\n");
for (int i=0; i < size; i++)
{
Console.WriteLine("myIndex[{0}]: {1}", i, myIndex[i]);
}
}
}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
to add tags.
Indexer
.
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Hot to import data set to a CSV file
Previous Resource:
Programmatically Download File from Remote Location to User Through Server
Return to Discussion Resource Index
Post New Resource
Category:
C# Syntax
Post resources and
earn money
!
More Resources
Hot to import data set to a CSV file
convert a string to an int
Using Thread Pool in .net
How can I get at the Win32 API from a .NET program.
Creates an AppDomain
How to create custom metadata attributes
dotNet Slackers
About Us
Contact Us
Privacy Policy
Terms Of Use