¡@

Home 

c# Programming Glossary: prop

Convert IEnumerable to DataTable

http://stackoverflow.com/questions/1253725/convert-ienumerable-to-datatable

to a DataTable I could use reflection to get the properties and the values but that seems a bit inefficient is there.. values. The code I wrote below handles the null values properly. public static DataTable ToDataTable T this IEnumerable.. IEnumerable T items Create the result table and gather all properties of a T DataTable table new DataTable typeof T .Name PropertyInfo..

How can I create a more user-friendly string.format syntax

http://stackoverflow.com/questions/1322037/how-can-i-create-a-more-user-friendly-string-format-syntax

0 value key else if cache.TryGetValue key out value var prop type.GetProperty key if prop null throw new ArgumentException.. key out value var prop type.GetProperty key if prop null throw new ArgumentException Not found key pattern value.. Not found key pattern value Convert.ToString prop.GetValue template null cache.Add key value return lBrace..

Where to learn about VS debugger 'magic names'

http://stackoverflow.com/questions/2508828/where-to-learn-about-vs-debugger-magic-names

types of anonymous methods backing fields of automatic properties and so on. My question where to learn about these naming.. field Field j anonymous type type parameter TPar k auto prop field BackingField l iterator thread id m iterator finally Finally..

Comparing 2 objects and retrieve a list of fields with different values

http://stackoverflow.com/questions/3060382/comparing-2-objects-and-retrieve-a-list-of-fields-with-different-values

var add typeof List string .GetMethod Add foreach var prop in typeof T .GetProperties if prop.CanRead continue Label.. Add foreach var prop in typeof T .GetProperties if prop.CanRead continue Label next il.DefineLabel switch Type.GetTypeCode.. Label next il.DefineLabel switch Type.GetTypeCode prop.PropertyType case TypeCode.Boolean case TypeCode.Byte case..

Anonymous Types - Are there any distingushing characteristics?

http://stackoverflow.com/questions/315146/anonymous-types-are-there-any-distingushing-characteristics

like... public static T Get T this IAnonymous obj string prop return T obj.GetType .GetProperty prop .GetValue obj null ..... obj string prop return T obj.GetType .GetProperty prop .GetValue obj null ... And then used like... var something new.. object It will be generic with as many type parameters as properties. You can have a non generic anonymous type with no properties...

Performance Tests of Serializations used by WCF Bindings

http://stackoverflow.com/questions/3790728/performance-tests-of-serializations-used-by-wcf-bindings

false .Add Array.ConvertAll typeof Game .GetProperties prop prop.Name meta.Add typeof Player false .Add Array.ConvertAll.. .Add Array.ConvertAll typeof Game .GetProperties prop prop.Name meta.Add typeof Player false .Add Array.ConvertAll typeof.. false .Add Array.ConvertAll typeof Player .GetProperties prop prop.Name return meta.Compile Serializable DataContract public..

Dynamic LINQ OrderBy on IEnumerable<T>

http://stackoverflow.com/questions/41244/dynamic-linq-orderby-on-ienumerablet

below. This covers most common scenarios including nested properties. To get it working with IEnumerable T you could add some.. T OrderBy T this IQueryable T source string property return ApplyOrder T source property OrderBy public static.. T source string property return ApplyOrder T source property OrderBy public static IOrderedQueryable T OrderByDescending..

parse and execute JS by C#

http://stackoverflow.com/questions/4744105/parse-and-execute-js-by-c-sharp

private static T GetProperty T IActiveScriptProperty prop int index T defaultValue object value if prop.GetProperty index.. prop int index T defaultValue object value if prop.GetProperty index IntPtr.Zero out value 0 return defaultValue.. string.Empty return _name summary Gets a script engine property. summary typeparam name T The expected property type. typeparam..

How to get the PropertyInfo of a specific property?

http://stackoverflow.com/questions/491429/how-to-get-the-propertyinfo-of-a-specific-property

to get the PropertyInfo of a specific property I want to get the PropertyInfo for a specific property... property I want to get the PropertyInfo for a specific property. I could use foreach PropertyInfo p in typeof MyObject .GetProperties.. set static class Program static void Main PropertyInfo prop PropertyHelper Foo .GetProperty x x.Bar public static class..

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.. DataTable for int i 0 i props.Count i PropertyDescriptor prop props i table.Columns.Add prop.Name prop.PropertyType object..

.Net - Reflection set object property

http://stackoverflow.com/questions/619767/net-reflection-set-object-property

Reflection set object property Is there a way in .Net c# 3.5 I can use reflection to set.. a way in .Net c# 3.5 I can use reflection to set a object property Ex MyObject obj new MyObject obj.Name MyName I want to set.. MyName This will throw an exception if obj doesn't have a property called Name or it can't be set. Another approach is to get..

.NET - Convert Generic Collection to DataTable

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

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

How to get the list of properties of a class?

http://stackoverflow.com/questions/737151/how-to-get-the-list-of-properties-of-a-class

to get the list of properties of a class How do I get a list of all the properties.. of properties of a class How do I get a list of all the properties of a class c# .net reflection properties share improve.. list of all the properties of a class c# .net reflection properties share improve this question Reflection for an instance..