c# Programming Glossary: props
Convert IEnumerable to DataTable http://stackoverflow.com/questions/1253725/convert-ienumerable-to-datatable DataTable table new DataTable typeof T .Name PropertyInfo props typeof T .GetProperties BindingFlags.Public BindingFlags.Instance.. properties as columns to the datatable foreach var prop in props Type propType prop.PropertyType Is it a nullable type Get the.. datatable foreach var item in items var values new object props.Length for var i 0 i props.Length i values i props i .GetValue..
Implementing INotifyPropertyChanged - does a better way exist? http://stackoverflow.com/questions/1315621/implementing-inotifypropertychanged-does-a-better-way-exist field value OnPropertyChanged propertyName return true props private string name public string Name get return name set..
Dynamic LINQ OrderBy on IEnumerable<T> http://stackoverflow.com/questions/41244/dynamic-linq-orderby-on-ienumerablet T source string property string methodName string props property.Split '.' Type type typeof T ParameterExpression arg.. type x Expression expr arg foreach string prop in props use reflection not ComponentModel to mirror LINQ PropertyInfo.. name if accessor null if name.IndexOf '.' 0 string props name.Split '.' CallSite Func CallSite object object arr Array.ConvertAll..
Convert generic List/Enumerable to DataTable? http://stackoverflow.com/questions/564366/convert-generic-list-enumerable-to-datatable T this IList T data PropertyDescriptorCollection props TypeDescriptor.GetProperties typeof T DataTable table new DataTable.. typeof T DataTable table new DataTable for int i 0 i props.Count i PropertyDescriptor prop props i table.Columns.Add prop.Name.. for int i 0 i props.Count i PropertyDescriptor prop props i table.Columns.Add prop.Name prop.PropertyType object values..
Data binding dynamic data http://stackoverflow.com/questions/882214/data-binding-dynamic-data null listAccessors.Length 0 PropertyDescriptor props new PropertyDescriptor Columns.Count for int i 0 i props.Length.. props new PropertyDescriptor Columns.Count for int i 0 i props.Length i props i new PropertyBagPropertyDescriptor Columns.. Columns.Count for int i 0 i props.Length i props i new PropertyBagPropertyDescriptor Columns i return new PropertyDescriptorCollection..
Hows to quick check if data transfer two objects have equal properties in C#? http://stackoverflow.com/questions/986572/hows-to-quick-check-if-data-transfer-two-objects-have-equal-properties-in-c static readonly Func T T bool Compare static Cache var props typeof T .GetProperties if props.Length 0 Compare delegate.. static Cache var props typeof T .GetProperties if props.Length 0 Compare delegate return true return var x Expression.Parameter.. typeof T y Expression body null for int i 0 i props.Length i var propEqual Expression.Equal Expression.Property..
|