propertyinfo Questions

3

Solved

I am doing a project that where I need to register all the properties, because of the system being so huge it would require a lot of work to register all the properties that i want to be dependent ...
Stpeter asked 22/12, 2010 at 0:33

6

Solved

I've got an object that has a collection of properties. When I get the specific entity I can see the field I'm looking for (opportunityid) and that it's Value attribute is the Guid for this opportu...
Katti asked 15/10, 2014 at 12:37

6

Solved

I do some type analysis in runtime using Reflection. If I have a MethodInfo instance, how can I figure out if this is a "real" method or is a getter/setter method of a property? And if it is a prop...
Salazar asked 6/2, 2009 at 12:39

4

Solved

I am trying to set a value to a Nested Property of Class dynamically using reflection. Could anyone help me to do this. I am having a class Region like below. public class Region { public int id...
Tula asked 6/9, 2012 at 6:35

16

Solved

I have a class, lets call it Book with a property called Name. With that property, I have an attribute associated with it. public class Book { [Author("AuthorName")] public string Name { get; ...
Haricot asked 9/7, 2011 at 21:45

12

Solved

I'd like to set a property of an object through Reflection, with a value of type string. So, for instance, suppose I have a Ship class, with a property of Latitude, which is a double. Here's what ...
Antiphonary asked 6/7, 2009 at 20:43

2

Solved

I have the following code : PropertyInfo[] originalProperties = myType.GetProperties(); I want to exclude from originalProperties all the indexers (myVar["key"] appears as property named "Item")...
Mori asked 20/1, 2011 at 10:52

2

Solved

I want to set the values of the properties via reflection. In this thread they propose a solution. But the problem with the solution is that it is not instantiating the properties. But I want to ch...
Declarer asked 20/8, 2018 at 15:38

3

Solved

Is there a way to set a single value in an array property via reflection in c#? My property is defined like this: double[] Thresholds { get; set; } For "normal" properties I use this code to se...
Butcherbird asked 20/3, 2012 at 8:0

3

Solved

Browsing the .NET core source code for System.Linq.Expressions, I found the following code located here: MethodInfo mi = property.GetGetMethod(true); if (mi == null) { mi = property.GetSetMethod(...
Web asked 17/8, 2016 at 21:26

4

Solved

I have the following code: public class DataReader<T> where T : class { public T getEntityFromReader(IDataReader reader, IDictionary<string, string> FieldMappings) { T entity = Acti...
Hoppe asked 8/10, 2009 at 23:8

1

Solved

I mistakenly posted this question already at the SharePoint part. I need to map one model onto an other. Everything works well but the last property throws a TargetParameterCountException. The pro...
Ophthalmologist asked 26/4, 2016 at 6:44

4

Solved

How can I reflectively get the property that has the DataMember with a given name (let's assume every DataMember has a unique name)? For example, in the following code the property with the DataMem...
Chilly asked 3/2, 2013 at 10:28

3

Solved

I have an extension method to get property name as public static string Name<T>(this Expression<Func<T>> expression) { MemberExpression body = (MemberExpression)expression.Body;...
Bannon asked 3/9, 2015 at 13:4

7

Solved

There is a whole wealth of reflection examples out there that allow you to get either: All properties in a class A single property, provided you know the string name Is there a way (using reflect...
Faints asked 7/9, 2010 at 19:6

4

public class BaseDto { public int ID{ get; set; } } public class Client: BaseDto { public string Surname { get; set; } public string FirstName{ get; set; } public string email{ get; set; } } ...
Gerdi asked 15/11, 2013 at 7:44

1

Solved

.Net 4.5 has PropertyInfo.GetMethod as a property on PropertyInfo class. Is it doing anything different from PropertyInfo.GetGetMethod method? The documentation page is virtually blank. The only di...
Bria asked 12/5, 2013 at 9:20

4

Solved

As disgussed in .NET Reflection set private property one can set a property with a private setter. But when the property is defined in a base class, System.ArgumentException is thrown : "Property s...
Replete asked 6/4, 2012 at 9:15

2

Solved

Why is the PropertyInfo methods for getting and setting a property so slow? If I build a delegate using Reflection.Emit, it is much faster. Are they doing something important, so that the time the...
Elspeth asked 7/10, 2012 at 7:56

1

Solved

I have no idea what these are for. The documentation is not very clear: GetField Specifies that the value of the specified field should be returned. SetField Specifies that the value of the specif...
Philipp asked 12/5, 2013 at 6:51

4

Solved

This is my very first post, and although I have searched in topics related to my issue to some extent, I'm having a lot of trouble finding the proper answer. My question may be very simple, but I'...
Arabella asked 26/3, 2013 at 15:45

2

Solved

I have some code that compares 2 PropertyInfos with Equals(). While this normally seems to work, I have run into a strange situation where two reflected property info objects for the same underlyin...
Hesperus asked 28/11, 2012 at 22:58

5

I need to pass selection of properties of some types(one type each time), assume this is my type: public class Product { [PrimaryKey] public long Id { get; set; } [DisplayName("Name")] public...
Paschasia asked 18/4, 2012 at 7:42

1

Solved

class SomeModel { [Display(Name = "Quantity Required")] public int Qty { get; set; } [Display(Name = "Cost per Item")] public int Cost { get; set; } } I'm trying to map the model into a list...
Filly asked 7/9, 2011 at 14:30

3

Solved

Ok, so I'm learning about generics and I'm trying to make this thing run, but its keep saying me the same error. Here's the code: public static T Test<T>(MyClass myClass) where T : MyClass2 ...
Vhf asked 26/8, 2010 at 16:49

© 2022 - 2025 — McMap. All rights reserved.