Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- public class Form1
- {
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- var entites = new List<Entite>()
- {
- new Entite() { Nom = "William " },
- new Employe() { Nom = "John doe" }
- };
- DataGridView1.DataSource = entites
- .Select(x => new { nom = x.Nom, x is Employe ? "Employe" : "Entite" })
- .ToList();
- }
- }
- public class Entite
- {
- public string Nom { get; set; }
- }
- public class Employe : Entite
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement