'Change Property Name While Adding To The List
I have a human list that I want to change the name of its properties while adding a record to it.
list<Human> HumansList = new list<Human>();
foreach(ListViewItem item in ListView.Items)
{
HumansList.Add(new Human{Name = item.subitems[1].text});
}
i want before top code,change the property whose name is Name to Name Of Guest for example to use for datagridview column header.in another word i want something like alias for my class's properties and When I display my list in Datagrid, the names of the columns should be different from the names of the properties and their value should be the same as the one I specified.
i try ExpandoObject and IDictionary too but i don't know how this work exactly?
what should i do it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
