Click here to Skip to main content
15,844,152 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
public class a
    {
        int[] z = new int[5] ;
        public int  this[int x]
        {
            get 
            {
                return (int)z[x];
            }

            set 
            {
                z[x] = value;
            }
        }
 
    }

this class has array
how i can pass values to this array by using this property
thnx for any help
Posted
Updated 10-Dec-10 17:03pm
v2
Comments
Toli Cuturicu 11-Dec-10 7:56am    
It is an indexer!

1 solution

Use a for loop and implement it as you like.
It could be user input or a pickup from a file or anything you like.

The question is hard to answer without more of a precise question.


but...

C#
for (int i = 1; i >= 10; i++)
{
    z(i)=i;
}
 
Share this answer
 
Comments
Mostafa Elsadany 11-Dec-10 0:39am    
thnx for help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900