TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
amit_gupta14
NA
119
0
Indexer:Why to use it if Public array can solve the purpose
Dec 13 2004 11:47 PM
1. If public array can solve the purpose, then why to use indexer 2.There is array member private int [] myArray = new int[100]; in class say c1. I have used the following code to use indexer public int this [int index] // Indexer declaration { get { // Check the index limits. if (index < 0 || index >= 100) return 0; else return myArray[index]; } set { if (!(index < 0 || index >= 100)) myArray[index] = value; } } It is working fine. But say there is another member private string [] myArray11 = new string[100]; in the same class along with previous member, then how to use indexer for it.
Reply
Answers (
3
)
Variables on the stack and their mapping???
Creating a database to use on my palm