"Hoi Wong" <wo*****@stanfo rd.eduwrote in message
news:fv******** **@news.Stanfor d.EDU...
In new versions of MATLAB, I can do dynamic field like
userdata.('user name').electroc ardiogram = 4,
where 'username' can be replaced by any string variable. This made my
software design much neater. Does anybody know if C# support that? If so,
what's the syntax?
I know you can do this with ADO.Net and C# when addressing fields in a
datatable dynamically addressing fields in the table by name. As a matter of
fact, I was taking a column/field name from a another table that
represented the fieldname in the table I wanted to access.
This just off the top of my head as to how it worked.
string fieldname = arow[brow["displayfldname "].Tostring()];
The field in arow was accessed via the name of the field that was in brow --
"displaynam e". Arow held the data that brow accessed to build dynamic
screens based on the tblScreenFields access into tblScreenData.
The ToString() was the key to getting it to work.
So, I don't see why you couldn't do the same in your example of addressing a
field dynamically, hopefully, and you can try it.