Advertisement
milen8204

Testing y++

Mar 23rd, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections;
  4.  
  5. struct Object
  6. {
  7.     public int x;
  8.     public int y;
  9.     public string c;
  10.     public ConsoleColor color;
  11. }
  12.  
  13. class Test
  14. {
  15.  
  16.     static void RocksMover(Object rockNew)
  17.     {
  18.         rockNew.y = (rockNew.y + 1);
  19.     }
  20.  
  21.     static void Main()
  22.     {
  23.         List<Object> newList = new List<Object>();
  24.  
  25.         for (int i = 0; i < 7; i++)
  26.         {
  27.             Object item = new Object();
  28.             item.x = 1;
  29.             item.y = 0;
  30.             item.c = "@";
  31.             item.color = ConsoleColor.Cyan;
  32.             newList.Add(item);
  33.         }
  34.  
  35.         foreach (var item in newList)
  36.         {
  37.             RocksMover(item);
  38.         }
  39.        
  40.         foreach (var item in newList)
  41.         {
  42.             Console.WriteLine(item.y);
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement