SHARE
TWEET

Untitled

a guest Dec 12th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top