repl.it
@kironroy/

indexers

C#

No description

fork
loading
Files
  • main.cs
  • ExampleDict.cs
  • HttpCookie.cs
  • main.exe
  • notes.txt
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Indexers
{

    class Program
    {
        static void Main(string[] args)
        {
            var cookie = new HttpCookie();
            cookie["name"] = "Grace Kelly";
            Console.WriteLine($"The first key is called 'name' and it's value is {cookie["name"]}, awesome person!");

            var cookieOne = new HttpCookie();
             cookieOne["nameOne"] = "Gene Autry";
           Console.WriteLine($"The second key is called 'nameOne' and it's value is {cookieOne["nameOne"]}, awesome person!");

            Breakline();

            // the key is an int and value is a string
            
            var numberDict = new ExampleDict(); 
            numberDict[1] = "one";
            Console.WriteLine($"The key is 1 and value is the string: {numberDict[1]}");

            var numberDictOne = new ExampleDict(); 
            numberDictOne[2] = "two";
            Console.WriteLine($"The key is 2 and value is the string: {numberDictOne[2]}");

            
        }

        public static void Breakline()
        {
          Console.WriteLine();
        }
    }
}