Advertisement
nahidjamalli

Lesson #14

Apr 26th, 2020
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace CSharpConsoleApp
  5. {
  6.     class MyClass
  7.     {
  8.         static void Main()
  9.         {
  10.             /*
  11.             List<int> siyahi2 = new List<int>();
  12.  
  13.             siyahi2.Add(1);
  14.             siyahi2.Add(2);
  15.             siyahi2.Add(3);
  16.             siyahi2.Add(4);
  17.             */
  18.  
  19.             // int[] a = new int[] { 1, 2, 3, 4 };
  20.             List<int> siyahi = new List<int> { 1, 2, 3, 4 };
  21.  
  22.             siyahi.Insert(2, 5000);
  23.  
  24.             for (int i = 0; i < siyahi.Count; i++)
  25.             {
  26.                 Console.WriteLine(siyahi[i]);
  27.             }
  28.  
  29.             Console.WriteLine("-------------------");
  30.  
  31.             foreach (int element in siyahi)
  32.             {
  33.                 Console.WriteLine(element);
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement