winforms - c# Generic list filter -


i have list of objects. classes looks this:

    class line     {     public string { get; set; }     public object b { get; set; }     public string c { get; set; }     }  class more_b {     public information information { { return _information; }}     public description description { { return _description ; }}      private information  _information  = new information();     private description  _description  = new description (); }  class information {     public string name { get; set;}     public string type { get; set;}     public string further_info { get; set;} } 

in main class @ end data inside line class this.

more_b info = new more_b();   line main = new line();  main.a = "information device";  main.b = info;  main.c = "some more information display here";  list3.add(main); 

so @ end list inside have 3 fields a b c. have string values in a , c , in b when check in debug mode have information object , inside of have fields name type , further_info.

i later want filter column based on these values "name" "type" , "further_info", tried way not working. (i binded list dataview able use rowfilter).

view2.rowfilter = "line '%" + textbox2.text + "%'"; 

how can right?

i new c#, please forgive me, if did wrong. if hard understand, let me know , try post more of code explaining did.

edit: when use statement view2.rowfilter = "line '%" + textbox2.text + "%'"; error cannot perform 'like' operation on read_display.more_b , system.string.

edit2: have 2 more methods creating datatable class , this: datatable listasdatatable2 = builddatatable2<line>(list3); dataview listasdataview2 = listasdatatable2.defaultview; this.datagridview4.datasource = view2 = listasdataview2;

try in way:

public class line {    public string {get;set;}    public more_b b {get;set;}    public string c {get;set;}           }  public class information {    public string name { get; set;}    public string type { get; set;}    public string further_info { get; set;} }  public class more_b:information {    public string cusotmfield {get;set;} }  var b_object = new more_b (name = "the b", type = "some type", further_info = "more info"); ilist<more_b> b_list=new list<more_b>(); var searchobj = b_list.where(x => x.name=="the b").firstordefault(); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -