C# 3.0 Anonymous Types: Naming
.net-3.0, anonymous-types, c#, naming
Solution
What about doing something like this:
var resultSet = from customer in customerList
select new
{
Value = customer.firstName,
Title = "First Name"
};
Then in your user control use Value as the contents and Title as the column name.
Problem
I was wondering if there is some way to name or rename a property on an Anonymous type to include a space in the property name. For example: ``` var resultSet = from customer in customerList select new { FirstName = customer.firstName; }; ``` In this example I would like FirstName to be "First Name". The reason for this question, is I have a user control that exposes a public DataSource property that I bind to different anonymous type. It is working perfectly right now, except for the one little shortcoming of the column names being a little less than user friendly (FirstName instead of First Name).