Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CLASS 1:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace safeprojectname
- {
- class Program
- {
- static void Main()
- {
- string[] loops = Xvalues.loops;
- Dictionary<int, string> dicto = Xvalues.DerpCats;
- List<int> DerpList = Xvalues.SirList;
- //takes the elements one for one and sets them as 'element' variable, taken from the 'loops' string.
- foreach (string element in loops)
- {
- Console.WriteLine(element);
- System.Threading.Thread.Sleep(1500);
- //does the case of the used element,
- switch (element)
- {
- case "ForEach loop:":
- {
- Console.WriteLine("This whole structure of writing is a ForEach loop with a switch!");
- break;
- }
- case "For loop:":
- {
- //checks how many elements the string has.
- for (int i = 0; i < loops.Length; i++)
- {
- //Console.WriteLine(loops[i]);
- Console.WriteLine(dicto[i]);
- Console.WriteLine(DerpList[i]);
- System.Threading.Thread.Sleep(1500);
- }
- break;
- }
- case "While loop:":
- {
- //easy, but the many letters are too awesome! xD
- int IsWhileExecutedTheStringLength = 0;
- while (IsWhileExecutedTheStringLength < loops.Length)
- {
- //Console.WriteLine(loops[IsWhileExecutedTheStringLength]);
- Console.WriteLine(dicto[IsWhileExecutedTheStringLength]);
- Console.WriteLine(DerpList[IsWhileExecutedTheStringLength]);
- IsWhileExecutedTheStringLength++;
- }
- break;
- }
- case "Do While loop:":
- {
- int TheDoWhileLoop = 0;
- do
- {
- //Console.WriteLine(loops[TheDoWhileLoop]);
- Console.WriteLine(dicto[TheDoWhileLoop]);
- Console.WriteLine(DerpList[TheDoWhileLoop]);
- TheDoWhileLoop++;
- } while (TheDoWhileLoop < loops.Length);
- break;
- }
- }
- Console.WriteLine();
- System.Threading.Thread.Sleep(1500);
- }
- Console.WriteLine("Done!");
- Console.ReadKey();
- }
- }
- }
- // CLASS 2:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace safeprojectname
- {
- public class Xvalues
- {
- public static string[] loops = { "ForEach loop:", "For loop:", "While loop:", "Do While loop:" };
- public static Dictionary<int, string> DerpCats = new Dictionary<int, string>()
- {
- {0, "hans"},
- {1, "greta" },
- {2, "Gruber" },
- {3, "SirCat" }
- };
- public static List<int> SirList = new List<int>()
- {
- {0},
- {1},
- {2},
- {3}
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment