Print Page | Close Window

Accessing a field through a variable

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4279
Printed Date: 21-Aug-2025 at 6:38pm


Topic: Accessing a field through a variable
Posted By: BillG
Subject: Accessing a field through a variable
Date Posted: 16-Aug-2013 at 5:33pm
let's say i have an object called member. It repesents the members table. In the object called member, i have a property called LastName. Now I have in my code i have assigned the string "LastName" to a variable
 
var fieldName = "LastName"
 
How do i retrieve the value of the LastName property from the member object using the fieldName string.
 
var lastName = member?????? fieldName;
 
 



Replies:
Posted By: smi-mark
Date Posted: 16-Aug-2013 at 8:29pm
This should do the trick:

EntityAspect.GetValue(variableName); 



Print Page | Close Window