How do I output the value of this table because it outputs to me:
lab5.FootballTeam - lab5.Tournament - System.Collections.Generic.HashSet`1[System.Int32]
lab5.FootballTeam - lab5.Tournament - System.Collections.Generic.HashSet`1[System.Int32]
lab5.FootballTeam - lab5.Tournament - System.Collections.Generic.HashSet`1[System.Int32]
And i need:
title1 city1 1910 turnirtilte1 true 1950 1980 1989
title2 city2 1920 turnirtilte1 true 1950 1991 1995
title3 city3 1930 turnirtilte1 true 1950 2002
Here is my code:
using System;
using System.Data;
using System.Collections.Generic;
namespace lab5
{
class FootballTeam
{
public string title;
public string city;
public int foundationYear;
public FootballTeam(string title1, string city1, int foundationYear1)
{
title = title1;
city = city1;
foundationYear = foundationYear1;
}
public string Print()
{
return $"{title},{city},{foundationYear}";
}
}
class Tournament
{
public string title;
public Boolean international;
public int foundationYear;
public Tournament(string title1, Boolean international1, int foundationYear1)
{
title = title1;
international = international1;
foundationYear = foundationYear1;
}
public string Print()
{
return $"{title},{international},{foundationYear}";
}
}
class Program
{
static void Main(string[] args)
{
var date1 = new DateTime(2008, 5, 1);
HashSet<int> set1 = new HashSet<int>();
HashSet<int> set2 = new HashSet<int>();
HashSet<int> set3 = new HashSet<int>();
HashSet<int> turnir = new HashSet<int>();
FootballTeam team1 = new FootballTeam("title1", "city1", 1910);
FootballTeam team2 = new FootballTeam("title2", "city2", 1920);
FootballTeam team3 = new FootballTeam("title3", "city3", 1930);
Tournament tournament1 = new Tournament("turnirtilte1", true, 1950);
turnir.Add(1980);
turnir.Add(1989);
turnir.Add(1991);
turnir.Add(1995);
turnir.Add(2002);
set1.Add(1980);
set1.Add(1989);
set2.Add(1991);
set2.Add(1995);
set3.Add(2002);
DataTable dt = new DataTable();
dt.Columns.Add("FootballTeam", typeof(FootballTeam));
dt.Columns.Add("Tournament", typeof(Tournament));
dt.Columns.Add("HashSet", typeof(HashSet<int>));
dt.Rows.Add(team1, tournament1, set1);
dt.Rows.Add(team2, tournament1, set2);
dt.Rows.Add(team3, tournament1, set3);
var selectedBooks = dt.Select();
foreach (var b in selectedBooks)
{
Console.WriteLine("{0} - {1} - {2}", b["FootballTeam"], b["Tournament"], b["HashSet"]);
}
}
}
}
Thank you very much.