How do I define a property to read an attribute from, without instantionating an object?
<p>Suppose I have:</p>

<pre><code>class Person
{
[ColumnAttribute("ID"]
    public int Id;
[ColumnAttribute("Name"]
public string Name;
[ColumnAttribute("DateOfBirth"]
    public date BirthDate;
}
</code></pre>

<p>I want to read the attribute on some property but without instantionating the Person object. Say for example I want to read the attribute defined on Name property.But I want it to be like that ReadAttribute(Person.Name) without creating an object.</p>

<p>Why do I want that? because this Person object is a Entity object for a framework I am creating, and I want to be able to define the column on which I want to sort the return from the DAL Layer.  </p>

<p>I don't want to pass strings because that way the string will get out of sync when I change the database and so on.  </p>

<p>So is this possible? The function of the dal is Person.GetAllByAge(int Age, /<em>somehow here I want to define the sorting</em>/)<br>
If there is another way to fix this problem I will be happy to hear it. I was thinking of using expression tree maybe, but I am stuck there too.<br>
thanks</p>

<h2>Edit:</h2>

<p>thank you all for answearing but the question is not about reading attributes.<br>
i want when calling the dal to call something like that<br>
Dal.Person.GetAllByAge(25, BirthDate)<br>
this will return all the persons which are 25 years old sorted by name<br>
this can be done currently by calling<br>
Dal.Person.GetAllByAge(25, "DateOfBirth")<br>
thanks</p>
