Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Form1
  6. {
  7. protected override void OnLoad(EventArgs e)
  8. {
  9. base.OnLoad(e);
  10.  
  11. var entites = new List<Entite>()
  12. {
  13. new Entite() { Nom = "William " },
  14. new Employe() { Nom = "John doe" }
  15. };
  16.  
  17. DataGridView1.DataSource = entites
  18. .Select(x => new { nom = x.Nom, x is Employe ? "Employe" : "Entite" })
  19. .ToList();
  20. }
  21. }
  22.  
  23. public class Entite
  24. {
  25. public string Nom { get; set; }
  26. }
  27.  
  28. public class Employe : Entite
  29. {
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement