fieldinfo Questions

8

Solved

For properties there are GetGetMethod and GetSetMethod so that I can do: Getter = (Func<S, T>)Delegate.CreateDelegate(typeof(Func<S, T>), propertyInfo.GetGetMethod()); and Setter ...
Ainslee asked 18/4, 2013 at 1:36

1

Solved

I am currently using FieldInfo.GetValue and FieldInfo.SetValue quite a lot in my programm, which is significantly slowing up my programm. For PropertyInfo I use the GetValueGetter and GetValueSett...
Coralyn asked 22/7, 2016 at 14:11

1

Solved

Following the examples on this post and its follow-up question, I am trying to create field getters / setters using compiled expressions. The getter works just great, but I am stuck the setter, as...
Gilding asked 22/7, 2016 at 13:7

3

Solved

I'm trying to get the field info of an array value from within a struct. So far I have the following, but I dont see how to get the infomration I want. [StructLayout(LayoutKind.Sequential)] publ...
Elvinaelvira asked 3/8, 2009 at 14:55

1

Solved

The FieldInfo documentation I was able to find did not compare and contrast these two methods. I am interested in understanding when one should be used over the other (preferably with a small code ...
Shirashirah asked 26/5, 2014 at 2:24

2

the problem is that we cannot GetValue of a field (non generic) that only resides in base class that has generic type. please see the code snippet below. calling f.GetValue(a) will throw the ex...
Rupture asked 11/7, 2012 at 23:2

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

2

Solved

class Bla { public readonly int sum; } FieldInfo f = type.GetField("sum"); f.?? // what? How do I find if sum is readonly or not? For properties I can do PropertyInfo.CanWrite to find if the me...
Seethrough asked 31/3, 2013 at 14:14

2

Solved

I am trying to set an array field using reflection like this: FieldInfo field = ... A[] someArray = GetElementsInSomeWay(); field.SetValue(this, someArray); The field has type B[]. B inherits fr...
Andalusite asked 9/12, 2012 at 18:46
1

© 2022 - 2024 — McMap. All rights reserved.