nord vpnnord vpn
Ad

Untitled

mail@pastecode.io avatar
unknown
csharp
a year ago
1.2 kB
1
Indexable
Never
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Testailua
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, Auto> sanakirja = new Dictionary<int, Auto>();

            Auto auto1 = new Auto(1998, "Corolla");
            Auto auto2 = new Auto(2021, "Golf");

            sanakirja.Add(1, auto1);
            sanakirja.Add(2, auto2);
            

            IEnumerable<KeyValuePair<int, Auto>> autot = sanakirja.Where(pari => pari.Key > 0);

            foreach (var item in autot)
            {
                Console.WriteLine(item);
            }


        }
    }

    class Auto
    {
        public int Vuosi { get; set; }
        public string Malli { get; set; }

        public Auto(int vuosi, string malli)
        {
            Vuosi = vuosi;
            Malli = malli;
        }

        public override string ToString()
        {
            return this.Malli + " " + this.Vuosi;
        }
    }
}

nord vpnnord vpn
Ad