Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetField returning null

Tags:

c#

.net

i'm trying to getField but is always returning null Here's a image of the code and the watchs of the variables.

Code: FieldInfo xSortField = xFieldInfo.GetValue(x).GetType().GetField(this.prefixedSortBy[i]);

enter image description here

like image 927
Luis Avatar asked Dec 04 '22 03:12

Luis


1 Answers

You need to use BindingFlags

GetField("FieldName", BindingFlags.Instance | BindingFlags.Public);
like image 123
f14shm4n Avatar answered Dec 25 '22 00:12

f14shm4n