Advertisement
comanee

ram12

Oct 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1.  
  2. using System; class IntIndexer
  3. {
  4. private string[] myData; public IntIndexer(int size)
  5. {
  6. myData = new string[size]; for (int i=0; i < size; i++) { myData[i] = "empty";
  7. } } public string this[int pos] { get
  8. { return myData[pos]; } set {
  9. myData[pos] = value;
  10. } } static void Main(string[] args) { int size = 10; IntIndexer myInd = new IntIndexer(size); myInd[9] = "Some Value"; myInd[3] = "Another Value"; myInd[5] = "Any Value"; Console.WriteLine("\nIndexer Output\n"); for (int i=0; i < size; i++) { Console.WriteLine("myInd[{0}]: {1}", i, myInd [i]); } } }
  11. for download this code from her
  12. http://tuc-urls.com/g41
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement