Click here to Skip to main content
15,885,670 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to write an element address of array in C# Pin
Kornfeld Eliyahu Peter28-Jun-14 19:57
professionalKornfeld Eliyahu Peter28-Jun-14 19:57 
QuestionMessage Closed Pin
28-Jun-14 9:35
Csíkszentmihályi28-Jun-14 9:35 
QuestionCan the recall frmLogIn ? Pin
Member 245846728-Jun-14 5:38
Member 245846728-Jun-14 5:38 
AnswerRe: Can the recall frmLogIn ? Pin
Richard Deeming30-Jun-14 1:51
mveRichard Deeming30-Jun-14 1:51 
GeneralRe: Can the recall frmLogIn ? Pin
Member 24584674-Jul-14 21:02
Member 24584674-Jul-14 21:02 
GeneralRe: Can the recall frmLogIn ? Pin
Richard Deeming7-Jul-14 2:02
mveRichard Deeming7-Jul-14 2:02 
GeneralRe: Can the recall frmLogIn ? Pin
Member 24584678-Jul-14 20:49
Member 24584678-Jul-14 20:49 
QuestionTrying to get List<T> through reflection Pin
joost.versteegen28-Jun-14 5:29
joost.versteegen28-Jun-14 5:29 
hello,
i'm trying to get a list<t> through reflection and pass it to a procedure, but can't get it to work. Can anyone give me a hint please?
here's what i ave sofar:

C#
public partial class Form1 : Form
{
  public Form1()
  {
    InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {
    Data data = new Data();

    string name = "Persons";
    Type type = data.GetType();
    PropertyInfo listProperty = type.GetProperty(name);

    //BindData<object>((List<object>)listProperty.GetValue(data, null));

    List<object> listObject = (List<object>)listProperty.GetValue(data, null);
  }

  private void BindData<T>(List<T> data)
  {
    comboBox1.DataSource = null;
    comboBox1.DataSource = data;
  }
}

public class Person
{
  public string Name { get; set; }
  public int Age { get; set; }

  public Person(string name, int age)
  {
    Name = name;
    Age = age;
  }

  public override string ToString()
  {
    return Name;
  }
}

public class Data
{
  public Data()
  {
    Persons = new List<Person>();
    Persons.Add(new Person("One", 1));
    Persons.Add(new Person("Two", 2));
  }

  public List<Person> Persons { get; set; }
}

AnswerRe: Trying to get List<T> through reflection Pin
Alan N28-Jun-14 6:12
Alan N28-Jun-14 6:12 
GeneralRe: Trying to get List<T> through reflection Pin
joost.versteegen28-Jun-14 23:20
joost.versteegen28-Jun-14 23:20 
AnswerRe: Trying to get List<T> through reflection Pin
Alan N29-Jun-14 0:55
Alan N29-Jun-14 0:55 
GeneralRe: Trying to get List<T> through reflection Pin
joost.versteegen29-Jun-14 1:12
joost.versteegen29-Jun-14 1:12 
AnswerRe: Trying to get List<T> through reflection Pin
PIEBALDconsult28-Jun-14 7:48
mvePIEBALDconsult28-Jun-14 7:48 
AnswerRe: Trying to get List<T> through reflection Pin
Richard Deeming30-Jun-14 1:47
mveRichard Deeming30-Jun-14 1:47 
QuestionThesis Project Pin
jomilyn28-Jun-14 3:02
jomilyn28-Jun-14 3:02 
AnswerRe: Thesis Project Pin
Pete O'Hanlon28-Jun-14 3:07
mvePete O'Hanlon28-Jun-14 3:07 
GeneralRe: Thesis Project Pin
jomilyn28-Jun-14 3:33
jomilyn28-Jun-14 3:33 
GeneralRe: Thesis Project Pin
OriginalGriff28-Jun-14 3:59
mveOriginalGriff28-Jun-14 3:59 
GeneralRe: Thesis Project Pin
jomilyn28-Jun-14 4:07
jomilyn28-Jun-14 4:07 
GeneralRe: Thesis Project Pin
OriginalGriff28-Jun-14 4:11
mveOriginalGriff28-Jun-14 4:11 
GeneralRe: Thesis Project Pin
Tom Delany30-Jun-14 12:06
Tom Delany30-Jun-14 12:06 
Questioncannot found emailhandler in c# 2008 Pin
KaKoten27-Jun-14 22:19
KaKoten27-Jun-14 22:19 
AnswerRe: cannot found emailhandler in c# 2008 Pin
OriginalGriff27-Jun-14 22:34
mveOriginalGriff27-Jun-14 22:34 
GeneralRe: cannot found emailhandler in c# 2008 Pin
KaKoten27-Jun-14 22:41
KaKoten27-Jun-14 22:41 
GeneralRe: cannot found emailhandler in c# 2008 Pin
OriginalGriff27-Jun-14 22:45
mveOriginalGriff27-Jun-14 22:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.