¡@

Home 

c# Programming Glossary: propertydescriptor

WinForms DataGridView - databind to an object with a list property (variable number of columns)

http://stackoverflow.com/questions/4716092/winforms-datagridview-databind-to-an-object-with-a-list-property-variable-num

get set class BookList List BookDetails ITypedList public PropertyDescriptorCollection GetItemProperties PropertyDescriptor listAccessors.. public PropertyDescriptorCollection GetItemProperties PropertyDescriptor listAccessors var origProps TypeDescriptor.GetProperties typeof.. TypeDescriptor.GetProperties typeof BookDetails List PropertyDescriptor newProps new List PropertyDescriptor origProps.Count PropertyDescriptor..

How to copy value from class X to class Y with the same property name in c#?

http://stackoverflow.com/questions/531505/how-to-copy-value-from-class-x-to-class-y-with-the-same-property-name-in-c

Student source ... StudentDTO item new StudentDTO PropertyDescriptorCollection sourceProps TypeDescriptor.GetProperties student destProps.. destProps TypeDescriptor.GetProperties item foreach PropertyDescriptor prop in sourceProps PropertyDescriptor destProp destProps prop.Name.. item foreach PropertyDescriptor prop in sourceProps PropertyDescriptor destProp destProps prop.Name if destProp null destProp.SetValue..

Convert generic List/Enumerable to DataTable?

http://stackoverflow.com/questions/564366/convert-generic-list-enumerable-to-datatable

public static DataTable ToDataTable T this IList T data PropertyDescriptorCollection props TypeDescriptor.GetProperties typeof T DataTable.. DataTable table new DataTable for int i 0 i props.Count i PropertyDescriptor prop props i table.Columns.Add prop.Name prop.PropertyType object..

Model Binding to Enums in ASP.NET MVC 3

http://stackoverflow.com/questions/6051756/model-binding-to-enums-in-asp-net-mvc-3

controllerContext ModelBindingContext bindingContext PropertyDescriptor propertyDescriptor IModelBinder propertyBinder var propertyType..

.NET - Convert Generic Collection to DataTable

http://stackoverflow.com/questions/701223/net-convert-generic-collection-to-datatable

DataTable table CreateTable T Type entityType typeof T PropertyDescriptorCollection properties TypeDescriptor.GetProperties entityType.. foreach T item in list DataRow row table.NewRow foreach PropertyDescriptor prop in properties row prop.Name prop.GetValue item table.Rows.Add.. typeof T DataTable table new DataTable entityType.Name PropertyDescriptorCollection properties TypeDescriptor.GetProperties entityType..

Data binding dynamic data

http://stackoverflow.com/questions/882214/data-binding-dynamic-data

a type to pretend to have columns you need to use custom PropertyDescriptor implementations. There are several ways to do this depending.. i.e. not lists . Implementing ITypedList and providing a PropertyDescriptor model is hard work... hence it is only done very occasionally... new List string public List string Columns get private set PropertyDescriptorCollection ITypedList.GetItemProperties PropertyDescriptor listAccessors..

Use own IComparer<T> with Linq OrderBy

http://stackoverflow.com/questions/985657/use-own-icomparert-with-linq-orderby

sorting with linq protected override void ApplySortCore PropertyDescriptor property ListSortDirection direction _sortProperty property..