using System.Collections.Generic;
using System.Data.SqlClient;
public static void Main(string[] args)
var conexao = @"Server=.\sqlexpress;Database=StackOverFlow;Trusted_Connection=True;";
using (var conn = new SqlConnection(conexao))
ON TEL.IdCliente = CLI.IdCliente";
dynamic resultList = conn.Query(sql);
foreach(var r in resultList)
public int IdCliente { get; set; }
public string Nome { get; set; }
public List<Telefone> Telefones { get; set; }
public int IdTelefone { get; set; }
public int IdCliente { get; set; }
public string Numero { get; set; }
public class SqlConnection : IDisposable
public SqlConnection(string conexao)
public dynamic Query(string query)
var c1 = new { IdCliente = 1, Nome = "Joao", IdTelefone = 1, Numero = "12345678"};
var c2 = new { IdCliente = 1, Nome = "Joao", IdTelefone = 2, Numero = "98765432"};
var c3 = new { IdCliente = 2, Nome = "Maria", IdTelefone = 3, Numero = "55555555"};
var c4 = new { IdCliente = 3, Nome = "Jose", IdTelefone = 4, Numero = "77777777"};
return new[] { c1, c2, c3, c4 };