RE: DataGrid Combobox ColumnStyle with DataSource as ArrayList

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi again Luke,
I think what I need to do is to use reflection to late bind to the
structures underlying the arraylist, and then use dynamic invocation of their
public properties, as your MyCast function does. Is this way off track?

Thanks.
--
John


"Luke Zhang [MSFT]" wrote:

Dear John,

Thank you for your reply.



I know you have a performance problem using the ADO.Net and want to use the
ArrayList.

Your ArrayList is consisted of your own structures and you want to cast the
ArrayList by the index to your structure.

If I misunderstand you, please feel free to let me know.



I have written a simple example for you to do this cast,

public class Mydata

{

private int data1;

private String data2;



public Mydata(int n,String s)

{

data1 = n;

data2 = s;

}



public int Data1

{

get

{ return data1;}

set

{ data1 = value;}

}



public String Data2

{

get

{ return data2;}

set

{ data2 = value;}

}



public void MyCast()

{

ArrayList list = new ArrayList();

list.Add(new Mydata(1,"a"));

list.Add(new Mydata(2,"b"));

list.Add(new Mydata(3,"c"));

list.Add(new Mydata(4,"d"));



int i = ((Mydata)list[3]).Data1;

String s = ((Mydata)list[3]).Data2;

}



Hope this information will help you.


Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)


.



Relevant Pages

  • RE: DataGrid Combobox ColumnStyle with DataSource as ArrayList
    ... private int data1; ... private String data2; ... public String Data2 ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: 2.6.11-rc1-mm1
    ... but that's not a limitation of relayfs per se. ... Tracing is not a copy to userspace function or am I missing ... #define ltt_ev_process(ID, DATA1, DATA2) ...
    (Linux-Kernel)
  • Re: First steps on overloading
    ... Use the types of data1 and data2 and the type of result. ... familiar with (like dominance rules and multiple dispatch). ... In 95% cases the overloading can be resolved with no problems. ...
    (comp.lang.misc)
  • Re: First steps on overloading
    ... Use the types of data1 and data2 and the type of result. ... if you declare it "bottom-up" it is. ... In 95% cases the overloading can be resolved with no problems. ...
    (comp.lang.misc)
  • Re: First steps on overloading
    ... If "binop" is a binary operator (in the sense of taking two ... Use the type of data1. ... Use the types of both data1 and data2. ...
    (comp.lang.misc)