Pass property to access using .NET
Posted
by BitFiddler
on Stack Overflow
See other posts from Stack Overflow
or by BitFiddler
Published on 2010-05-29T19:42:48Z
Indexed on
2010/05/29
20:02 UTC
Read the original article
Hit count: 225
vb.net
I'm fairly sure this is possible, but what I want to do is have a generic method where I can pass in an object along with a Expression that will tell the method which Property to use in it's logic.
Can anyone get me started on the syntax for something like this?
Essentially what I would like to code is something like:
Dim firstNameMapper as IColumnMapper = new ColumnMapper(of Author)(Function(x) x.FirstName) Dim someAuthorObject as new Author()
fistNameMapper.Map("Richard", someAuthorObject)
Now the mapper object would know to set the FirstName property to "Richard".
Now using a Function here won't work, I know this... I'm just trying to give an idea what I'm trying to work towards.
Thanks for any help!
© Stack Overflow or respective owner